读书人

用for each通过查询串传递值时候出现了

发布时间: 2012-04-14 17:14:21 作者: rapoo

用for each通过查询串传递值时候出现了个问题求帮助
<c:forEach items="${operators}" var="operator">
<tr>
<td width="25%" align="center" height="17">${operator.operatorid}</td>
<td width="25%" align="center" height="17">${operator.operatorname}</td>
<td width="25%" align="center" height="17">${operator.isadmin}</td>
<td width="25%" align="center" height="17"><a href="modOperator.jsp?operators=operator">>></a></td>
</tr>
</c:forEach>



这里的operator是个vo,里面有id ,name 之类的信息
我通过点击不同的超链接到modOperator.jsp之后每次得到的内容都是第一次循环的数据 不是应该点击不同的超链接我得到不同的值么

[解决办法]
<a href="modOperator.jsp?operators=${operator}">>></a>
可以在超链接里面写EL表达式


[解决办法]
那你就写成这样嘛把ID和name都当参数传递过去
<a href="modOperator.jsp?operatorid=${operatorid}&operatorname=${operator.operatorname}">>></a>


[解决办法]

探讨

地址栏是正确的 我用
<%=request.getParameter("operatorid") %>
<%=request.getParameter("operatorname") %>
接收打印出来都是null奇怪啊

[解决办法]
你可以在检查一下,你的相关页面,是否经过多次转码!如果有,会影响到到你的数据接收的。

读书人网 >Java Web开发

热点推荐