这样写:
<s:set name="vis" value="%{visible}"/>
<s:if test="#vis == 0">
<s:set name="vis" value="%{visible}"/>
<s:if test="#vis == 0">
解决方案 »
- struts2的ModelDriven是否支持多对象。。
- SQL语句写入java程序
- struts多组radio框取值处理
- hibernate中,关于类继承后,导致分页取出结果集数量错误的严重问题,请各位帮忙。
- 初学EJB的问题,请前辈帮忙
- 请教jsp+javamail+james做邮件服务器问题.
- Middlegen-Hibernate的使用问题
- 在weblogic7里面使用smartupload组件上传文件的问题,java.lang.OutOfMemoryError
- Struts中使用validation框架的问题?
- ejb菜菜问题,请告知!
- 有没有java类可以实现excel转化成带有分隔符的txt文件,JExcelAPI能实现Excel的读入读出,不知道能否实现写入txt文本中
- 网络通信软件主要会用的那些JAVA技术?
/*
* 查询所有产品
*/
public String query() throws Exception {
list = productManagerService.query();
return "success";
}struts.xml <!-- 产品管理 -->
<action name="productmgr" class="com.shop.action.ProductManagerAction" method="addProduct">
<interceptor-ref name ="fileUploadStack" />
<result>/admin/product/listProduct.jsp</result>
<result name="print">/admin/product/listProduct.jsp</result>
</action>DaoImplpublic List query() throws Exception {
query = this.getSession().createQuery("from Product");
return query.list();
}数据能取出来.没有问题。
再个你传到页面的该是List<Product>,
那么你list = productManagerService.query(); 这里面的list要这样定义的List<Product> list
然后再看看是不是if的问题。另外如果用标签,就得有get方法了。还有建议判断前加个null==visible
试试
为什么你visible前面要加个#
它是变量吗?
建议楼主去看看s:iterator的用法吧,
它就是列出来所有list,这里,你s:iterator里面填充的内容格式应该是不对的,它首先有多少列,可以用td,th之类的先列出多少列,,然后用s:property来取值(或者是你设置的值)。在这个td里面可以先用s:if判断,然后输出你设定的值,或者是s:property来取值,你用上面的你的表达式来处理,它根本不知道你调用的这个list里面显示,所以这里显示是有问题的。
主要是现在在家里,前两天电脑出问题,所以盘全部都格式化了,不然传两个例子给你看看,你就明白了。
等等我去给你到我的网盘下两个李刚的,你一看就明白了
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>s:itertor标签测试</title>
</head>
<body>
<table border="1" width="150">
<s:iterator value="{'Spring2.0宝典','轻量级J2EE企业应用实战','基于J2EE的Ajax宝典'}" id="name" status="st">
<tr <s:if test="#st.odd">style="background-color:#bbbbbb"</s:if>>
<td><s:property value="name"/></td>
</tr>
</s:iterator>
</table>
<table border="1" width="100">
<s:iterator value="#{'语文':80 , '数学':49}" id="score" status="st">
<tr <s:if test="#st.odd">style="background-color:#bbbbbb"</s:if>>
<td><s:property value="key"/></td>
<td><s:property value="value"/></td>
</tr>
</s:iterator>
</table>
</body>
</html>