主页 > 编程资料 > JSP(JAVA) >
发布时间:2016-01-01 作者:网络 阅读:296次

本文实例讲述了JSP中正则表达式用法。分享给大家供大家参考,具体如下:

<%@ 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+"/";
%>


 
 
 My JSP 'El.jsp' starting page
  
  
   
  
  
  
 
 
 <%
   String data="assd";
   request.setAttribute("data", data);
 %>
 
 ${data }
 
<% Person p=new Person(); p.setName("name"); request.setAttribute("person", p); %> ${person.name}
<% Person p2=new Person(); Adddress add=new Adddress(); add.setCity("NewYork"); p2.setAddress(add); request.setAttribute("p2", p2); %> ${p2.address.city}
<% 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 }
<% 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.b.name} ${map['1'].name }
${pageContext.request.contextPath}

希望本文所述对大家JSP程序设计有所帮助。

关键字词: