action中的代码:private UserService userService;
private List list;
private Product product;
//初始化首页
public String initial(){
List<Product> list = userService.findProducts();
return "success";
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
jsp页面:<s:if test="list.size() != null && list.size() > 0">
<s:iterator value="list" status="s">
<tr
<s:if test="(#s.index + 1) % 2 == 0">class="tableRow2" onmousemove="this.className='tableRow3'" onmouseout="this.className='tableRow2'"</s:if>
<s:else>class="tableRow1" onmousemove="this.className='tableRow3'" onmouseout="this.className='tableRow1'"</s:else>
>
<td align="center">
<s:property value="(pager.thisPage - 1) * pager.pageSize + #s.index + 1"/>
</td>
<td align="center">
<a href="productDetail.jsp?productid=<s:property value="product_id"/>">
<s:property value="product_name"/>
</td>
<td align="center">
<s:property value="baseprice"/>
</td>
<td align="center">
<a href="shopcart.jsp">
<img border="0" src="images/car_new.gif" width="97" height="18">
</a>
</td>
</tr>
</s:iterator>
调试的时候list有值,但页面显示不出来
jsp list
request.setAttu...\这都不会??foreach 遍历元素页面上 可以得到 list 集合的内容吗?action 的属性 不知道能不能保存到值stack 中
一把它 手动放到作用域 然后在看看