JSP EL式学習ノート

6735 ワード

"java.util.HashMap"%>
"java.util.Map"%>
"java.util.ArrayList"%>
"java.util.List"%>
"java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="hah.*"
    errorPage="common/zz.jsp"
    %>
 "common/zz.jsp" --%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title heretitle>
head>
<body>
String name1="name1";
int name2=111;
int[] a=new int[3];
//int xx=10/0;//  
//out.write(xx);
a[1]=3;
Student student=new Student("ss",22);
request.setAttribute("name1", name1);
session.setAttribute("name2", name2);
request.setAttribute("intx", a);
session.setAttribute("student",student); 


List list=new ArrayList();
list.add(new Student("11",111));
list.add(new Student("22",222));
list.add(new Student("33",333));
request.setAttribute("listx",list);

Map<String,Student> map=new HashMap<String,Student>();
map.put("1", new Student("11",111));
map.put("2", new Student("22",222));
map.put("2", new Student("33",333));
pageContext.setAttribute("mapx",map);
%>
"true" %>       EL  ,TRUE    .FALSE     .JSP2.0      EL  。 --%>
 "name2")%> 
  
   "name")%>
    --%>
      EL   :
      ${name1 }
      
      ${sessionScope.name2 }
      ${intx[1] }
      ${student.name } - ${student.age }
      ${student["name"] } -${student["age"] } <br/>
      "student")).getName()%> --%>
      ${listx[2]["name"] } - ${listx[2].age }
      <br/>

      for(int i=0;i
             get(i).getName() +" | "+list.get(i).getAge()%>

      
          <br/>
          
          ${listx[1]["name"] }---${listx[1].age }
           0]          (        get(  )  )
            ((List)pageContext.findAttribute("list")).get(0)
        --%>
        <br/>
        ${mapx['1']["name"] }
        <br/>
3>=2 }
        ${
     10!=3 }
        
${ true||false} --%> String haha=""; request.setAttribute("haha", haha); %> null:${haha==null } : ${haha=="" }<br/> :${haha==null||haha=="" } : ${empty haha } body> html>