您的位置:首页 > 其它

Action和页面间迭代标签等传值

2014-03-17 10:01 381 查看
使用C标签:

Action(Servlet)中,

request.setAttribute("proList", proService.list());

Jsp中,

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>

<c:forEach items="${ requestScope.proList}" var="pro">

${pro.Id}

使用Struts标签:

Action(继承ActionSupport)中,

ActionContext.getContext().put("proList", proService.list());

Jsp中,

<%@ taglib prefix="s" uri="/struts-tags"%>

<s:iterator value="proList"> —— 注意属性 status,使用status="proIndex" ——获取序列号,从0开始, 即${proIndex.index + 1} 为1

${Id}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: