1,简单值
(1) List:
<c:forEach var="student" items="${sessionScope.list}" varStatus="status">
<font size=5 color=blue>
index:${status.index }<br>
ID:${student.id }<br>
Name:${student.name }<br>
Country:${student.address.country }<br>
City:${student.address.city }<br>
Street:${student.address.street } <br>
</font>
</c:forEach>
(2) map
<c:forEach var="entry" items="${sessionScope.map}" begin="0" end="4" step="1" varStatus="status" >
<font size=5 color=red>
index:${status.index }<br>
ID:${entry.key }<br> Name:${entry.value.name }<br>
Country:${entry.value.address.country }<br>
City:${entry.value.address.city }<br>
Street:${entry.value.address.street }<br> </font>
</c:forEach>
(3) Array
< c:forEach var = "color" items = "${sessionScope.colors}" >
${color}< br >
</c:forEach >
2,取对象的对象。
UserInfo里面已经有了DataObject data了,然后request.setAttribute("userInfo",userInfo),页面上就${userinfo.data.sex} 与${userinfo.data.age}
算了,直接写吧.
request.setAttribute("userinfo",userinfo);
然后页面
<c:set var="userinfo" value="${requestScope.userinfo}"/>
username:${userinfo.username}
password:${userinfo.password}
<c:set var="dataObject" value="${userinfo.dataObject}"/>
age:${dataObject.age}
sex:${dataObject.sex}
不知道这样对不,<bean>标签不怎么用,不熟悉,:)
<%@taglib prefix="c" uri=" http://java.sun.com/jsp/jstl/core"%>
<%@ page language=”java” pageEncoding=”GBK” %>
<%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=”c” %>
(1) List:
<c:forEach var="student" items="${sessionScope.list}" varStatus="status">
<font size=5 color=blue>
index:${status.index }<br>
ID:${student.id }<br>
Name:${student.name }<br>
Country:${student.address.country }<br>
City:${student.address.city }<br>
Street:${student.address.street } <br>
</font>
</c:forEach>
(2) map
<c:forEach var="entry" items="${sessionScope.map}" begin="0" end="4" step="1" varStatus="status" >
<font size=5 color=red>
index:${status.index }<br>
ID:${entry.key }<br> Name:${entry.value.name }<br>
Country:${entry.value.address.country }<br>
City:${entry.value.address.city }<br>
Street:${entry.value.address.street }<br> </font>
</c:forEach>
(3) Array
< c:forEach var = "color" items = "${sessionScope.colors}" >
${color}< br >
</c:forEach >
2,取对象的对象。
UserInfo里面已经有了DataObject data了,然后request.setAttribute("userInfo",userInfo),页面上就${userinfo.data.sex} 与${userinfo.data.age}
算了,直接写吧.
request.setAttribute("userinfo",userinfo);
然后页面
<c:set var="userinfo" value="${requestScope.userinfo}"/>
username:${userinfo.username}
password:${userinfo.password}
<c:set var="dataObject" value="${userinfo.dataObject}"/>
age:${dataObject.age}
sex:${dataObject.sex}
不知道这样对不,<bean>标签不怎么用,不熟悉,:)
<%@taglib prefix="c" uri=" http://java.sun.com/jsp/jstl/core"%>
<%@ page language=”java” pageEncoding=”GBK” %>
<%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=”c” %>