现在我写好了一个dao层 一个action 并且action的list中也传进值了,在页面上不能将值显示出来(用的是ssh2框架写的)
我的dao:
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException,
SQLException {
String q = " from Watch w,Style s,Type t where w.styleID=s.id and w.typeID=t.id order by " + orderby + " "+ ascordesc;
Query query = s.createQuery(q);
query.setFirstResult(firstResult);
query.setMaxResults(maxResults);
List list = query.list();
return list;
}
});
}
我的action:
public String list() {
Pages pages = new Pages();
pages.setPage(this.getPage());
pages.setPerPageNum(40); pages
.setFileName(CommUtil
.getActionMappingURLWithoutPrefix("watchInfo?ajax=shtml&action="
+ this.getAction()));
this.setPageList2(this.getWatchService().findWatchList("wdate", "asc",
pages));
return "watchList";
}
我的jsp页面:
<s:iterator id="watchInfo" value="%{pageList2.objectList}">
<tr>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.wdate"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.wweek"/></div></td>
<td class="bgColor2"><div align="left"><s:property value="#watchInfo.typeName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.styleName"/></div></td>
<td class="bgColor2"><div align="center"><s:property value="#watchInfo.lxrName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.zuName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.notes"/></div></td>
</tr>
</s:iterator>
表结构是这样的:
style (id,styleName)
tyle (id,typeName)watch(id,styleid,typeid,wdate)
其中style表中的id与watch表中的styleid关联
type表中的id与watch表中的typeid关联
请教高手了,为啥页面上不显示值呢?也不报错
还是我的方法有问题?谢谢!
我的dao:
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException,
SQLException {
String q = " from Watch w,Style s,Type t where w.styleID=s.id and w.typeID=t.id order by " + orderby + " "+ ascordesc;
Query query = s.createQuery(q);
query.setFirstResult(firstResult);
query.setMaxResults(maxResults);
List list = query.list();
return list;
}
});
}
我的action:
public String list() {
Pages pages = new Pages();
pages.setPage(this.getPage());
pages.setPerPageNum(40); pages
.setFileName(CommUtil
.getActionMappingURLWithoutPrefix("watchInfo?ajax=shtml&action="
+ this.getAction()));
this.setPageList2(this.getWatchService().findWatchList("wdate", "asc",
pages));
return "watchList";
}
我的jsp页面:
<s:iterator id="watchInfo" value="%{pageList2.objectList}">
<tr>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.wdate"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.wweek"/></div></td>
<td class="bgColor2"><div align="left"><s:property value="#watchInfo.typeName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.styleName"/></div></td>
<td class="bgColor2"><div align="center"><s:property value="#watchInfo.lxrName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.zuName"/></div></td>
<td class="bgColor4"><div align="center"><s:property value="#watchInfo.notes"/></div></td>
</tr>
</s:iterator>
表结构是这样的:
style (id,styleName)
tyle (id,typeName)watch(id,styleid,typeid,wdate)
其中style表中的id与watch表中的styleid关联
type表中的id与watch表中的typeid关联
请教高手了,为啥页面上不显示值呢?也不报错
还是我的方法有问题?谢谢!
解决方案 »
- struts2里 XXX-validation.xml 里IP验证! 急
- 上传图片到数据库
- weblogic8.1环境中解析xml出现Invalid encoding name "GBK"的问题.
- MyEclipse4.1的hibernate怎么配置啊?
- 第一个简单的javamail出错,,绝对简单,,可我是错啦????
- 正解必给分!(在线等待)
- 对mastering jakarta struts55页的例子编译不过去!
- 通过jsp,服务器如何传输文件到客户机?
- Spring3,Hibernate4使用Annotation实体映射数据库问题
- 怎么用jQuery 点击保存 取到全选和单选checkbox的 编号和名称的值
- 分页组件eXtremeComponents的state,用过的高手进来看下
- se过后的一道坎,黎明前最黑暗的时刻,发一文字编辑器,向JSP开进
这个写错了
<s:iterator id="watchInfo" value="%{#pageList2.objectList}">
或者
<s:iterator id="watchInfo" value="#pageList2.objectList">
试试
那应该是页面取值的问题
你先用脚本<% request.getAttribute.......%>取了看看是否取到
然后
在${list}测试
如果${list}有值你迭代出了问题
如果没有那就看是否存了值