SSH2项目中,JSP中如何遍历如下LIST 5
展开全部
<c:forEach items="${list}" var="user" varStatus="vs">
<tr>
<td>
<s:property value="#vs.index+1"/>
</td>
<td align = "center">${user.PId}</td>
<td align = "center">${user.PLoginname}</td>
<td align = "center">${user.PUserName}</td>
<td align = "center">${user.PEmail}</td>
<td align = "center"><html:department pdeptid="${user.PDeptid}"></html:department></td>
</tr>
</c:forEach>
${list}为后台传的list集合,用到了jsp的标签,需要引入
<tr>
<td>
<s:property value="#vs.index+1"/>
</td>
<td align = "center">${user.PId}</td>
<td align = "center">${user.PLoginname}</td>
<td align = "center">${user.PUserName}</td>
<td align = "center">${user.PEmail}</td>
<td align = "center"><html:department pdeptid="${user.PDeptid}"></html:department></td>
</tr>
</c:forEach>
${list}为后台传的list集合,用到了jsp的标签,需要引入
追问
java.lang.NumberFormatException: For input string: "ylzNames" 抱这样的错误
追答
数字转换异常,你是把字符串ylzNames强制转换成数字,所有报错了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询