日期:2014-05-20 浏览次数:20708 次
<form action="searchMyCurRecord.action" method="post"> <table align="center"> <input align="center" type="submit" value="查看借书情况"/> <% if(session.getAttribute("myCurRecordList")==null); else{ out.println("<caption><h4>当前借书情况</h4> </caption>"); out.println("<tr>"); out.println("<th>书名</th>"); out.println("<th>图书编号</th>"); out.println("<th>借书日期</th>"); out.println("</tr>"); out.println("<s:iterator value=\"#session.myCurRecordList\" id=\"myCurRecordList\" status=\"st\">"); out.println("<tr>"); out.println("<td>${myCurRecordList.RBname }</td>"); out.println("<td>${myCurRecordList.RBid }</td>"); out.println("<td>${myCurRecordList.ROut }</td>"); out.println("</tr>"); out.println("</s:iterator> "); } %> </table> </form>
搞不懂你页面中为什么要这么去输出 out.println("<caption><h4>当前借书情况</h4> </caption>"); out.println("<tr>"); out.println("<th>书名</th>"); out.println("<th>图书编号</th>"); out.println("<th>借书日期</th>"); out.println("</tr>"); out.println("<s:iterator value=\"#session.myCurRecordList\" id=\"myCurRecordList\" status=\"st\">"); out.println("<tr>"); out.println("<td>${myCurRecordList.RBname }</td>"); <color>// 既然都用了strust2了标签了为什么这里要用el表达式</color> out.println("<td>${myCurRecordList.RBid }</td>"); out.println("<td>${myCurRecordList.ROut }</td>"); out.println("</tr>"); out.println("</s:iterator> "); 反正都是在页面上。。。改成这样吧 1. Map<String, Object > session=(Map<String, Object >)context.getSession(); 将object改为你的对象,不然页面上用标签循环的时候,无法识别具体对象,所以无法直接输出属性 2. <caption><h4>当前借书情况</h4></caption> <tr> <th>书名</th> <th>图书编号</th> <th>借书日期</th> </tr> <s:iterator value="#session.myCurRecordList" id="myCurRecordList" status="st"> <tr> <td><s:property value='RBname' /></td> <td><s:property value='RBid' /></td> <td><s:property value='ROut' />/td> </tr> </s:iterator>
------解决方案--------------------
1. <s:iterator value=\"#session.myCurRecordList\" id=\"myCurRecordList\" status=\"st\"> 这里面的斜杠是干嘛的?