정규 표현 식 JSP 인 스 턴 스

3154 단어 정규 표현 식
<%@ page language="java" import="java.util.*,cn.com.Person,cn.com.Adddress" pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

  <head>

    <base href="<%=basePath%>">

    

    <title>My JSP 'El.jsp' starting page</title>

    

	<meta http-equiv="pragma" content="no-cache">

	<meta http-equiv="cache-control" content="no-cache">

	<meta http-equiv="expires" content="0">    

	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

	<meta http-equiv="description" content="This is my page">

	<!--

	<link rel="stylesheet" type="text/css" href="styles.css">

	-->



  </head>

  

  <body>

  	

    <%

    	String data="assd";

    	request.setAttribute("data", data);

    %>

    <!--      ,   Request              

  		   :pageContext.findAttribute("data");

  		       

  	-->

    ${data }

    <br/>

    

    <%

    	Person p=new Person();

    	p.setName("name");

    	request.setAttribute("person", p);	

    %>

    <!--   name          

    	    JAVABean       :

    -->

    ${person.name}

    

     <br/>

    <%

    	Person p2=new Person();

    	Adddress add=new Adddress();

    	add.setCity("NewYork");

    	p2.setAddress(add);

    	request.setAttribute("p2", p2);

     %>

     <!--         Person     Adddress  

     	Person     :private Adddress address;

     	                 

     	     bean        :

      -->

     ${p2.address.city}

     <br/>

     

     <%

     	ArrayList list=new ArrayList();

     	list.add(new Person("wy"));

     	list.add(new Person("wyy"));

     	list.add(new Person("wyyy"));

     	request.setAttribute("list", list);

      %>

      <!--              ? -->

      ${list[1].name }

      <br/>

      

      <%

      	Map map=new HashMap();

      	map.put("1", new Person("aaaa"));

      	map.put("b", new Person("bbbb"));

      	map.put("c", new Person("cccc"));

      	map.put("d", new Person("dddd"));

      	request.setAttribute("map", map);

       %>

       <!-- 

       		Map             ?

       		map          id       :   500  

       		               

       		.          []

        -->

       ${map.b.name}

       ${map['1'].name }

       <br/>

       <!--      web    -->

       ${pageContext.request.contextPath}

      	<a href="${pageContext.request.contextPath}/demo1.jsp" > </a>

  </body>

</html>

좋은 웹페이지 즐겨찾기