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

使用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}



你可能感兴趣的:(Action和页面间迭代标签等传值)