数据库取出的值放在页面上遍历用struts2这样写取不出来值 10

<s:iteratorvalue="#request.select"status="employee"><tr><td><s:propertyvalue="employe... <s:iterator value="#request.select" status="employee">
<tr>
<td><s:property value="employee.week"/></td>
<td><s:property value="employee.workStart"/></td>
<td><s:property value="employee.workEnd"/></td>
</tr>
</s:iterator>

然后我用c标签
<c:forEach items="${requestScope.select}" var="select" varStatus="status">
<td>${select.workStart}</td>

</c:forEach>
报了这样的错误:org.apache.jasper.JasperException: java.lang.NumberFormatException: For input string: "workStart"
我是从数据库中取的值。。。。求解
展开
 我来答
anyuntunri
2012-06-13 · TA获得超过1720个赞
知道小有建树答主
回答量:740
采纳率:50%
帮助的人:337万
展开全部
<s:iterator value="#request.select" var="employee">
<tr>
<td><s:property value="#employee.week"/></td>
<td><s:property value="#employee.workStart"/></td>
<td><s:property value="#employee.workEnd"/></td>
</tr>
</s:iterator>
geovil
2012-06-13 · 超过34用户采纳过TA的回答
知道答主
回答量:120
采纳率:0%
帮助的人:80.5万
展开全部
<s:iterator 使用不对,s:iterator 是遍历value属性对应的集合对象 如list hashtable hashcode等。你好好在网上看看<s:iterator 用法吧。同时数据查询结果要放在这个集合对象中,并且要传递到界面上,如果是请求action获取的数据,在action中生成集合对象对应的set get 方法就可以了。
更多追问追答
追问
我就是遍历的list集合
HttpServletRequest request=ServletActionContext.getRequest();
String datechuqin=request.getParameter("datechuqin"); //string
String staffcode=request.getParameter("staffcode");
List select= empService.queryEmployee(datechuqin,staffcode); request.setAttribute("select", select);
这是我后台action中写的
追答


这样试试
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友60ba0a5
2012-06-14 · TA获得超过231个赞
知道小有建树答主
回答量:544
采纳率:100%
帮助的人:208万
展开全部
首先struts2没有status这个属性的,你可以使用var,但实际上一个value属性就够你用了。然后你可以直接在action中定义select然后去get,set方法,这样你可以直接在 value中写select就好,在s:property中,value中直接写属性名字就好了,比如说week,直接这样子写就好,你试下吧,这已经是常用的写法了
追问
上面那个网友已经说了这种方法我也试过了,可是就是出不来。不过谢谢你的解答。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式