日期:2014-05-17  浏览次数:20757 次

JSP页面跳转显示数据问题!弄了几天了!求解决
<struts>
 <package name="mintao" extends="struts-default">
  <action name="zw" class="stuaction">
  <result type="redirectAction">getall</result>
  <result name="input">addstu.jsp</result>
  </action>
  <action name="getall" class="stuaction" method="getall">
  <result>showlist.jsp</result>
  <result name="input">addstu.jsp</result>
  </action>
  <action name="delstu" class="stuaction" method="delStudent">
  <result type="redirectAction">getall</result>
  <result name="input">detail.jsp</result>
  </action>
  <action name="updatestu" class="stuaction" method="updateStu">
  <result type="redirectAction">getall</result>
  <result name="input">detail.jsp</result>
  </action>
  <action name="getstu" class="stuaction" method="getStuById">
  <result>detail.jsp</result>
  <result name="input">showlist.jsp</result>
  </action>
 </package>
</struts>


//这个是showlist.jsp
<body>
  <form action="updatestu.action?id=${sid}" method="post">
  <table>
  <tr>
  <td>编号</td>
  <td>姓名</td>
  <td>年龄</td>
  <td>住址</td>
  <td>联系电话</td>
  <td>所在学校</td>
  <td>操作</td>
  </tr>
   
  <!-- iterator 迭代 循环显示 -->
   
  <s:iterator var="stu" value="stulist" >
  <tr>
  <td><s:property value="sid"/></td>
  <td><s:property value="sname"/></td>
  <td><s:property value="sage"/></td>
  <td><s:property value="sadress"/></td>
  <td><s:property value="sphone"/></td>
  <td><s:property value="school"/></td>
   
  <!-- 当点击详细的时候,就是进行查询单个的操作,根据传的id查询对应的单个 -->
   
  <td><input type="button" value="详细" onclick="javascript:location.href='getstu.action?id=${sid}'"/></td>
  </tr>
  </s:iterator>
  </table>
  </form>
  </body>
</html>


//这个是detail.jsp
<body>
  <form action="">  
  <table>  
  <tr>
  <td>姓名:</td>
  <td><input type="text" value="${stu.sname }"></input></td>
  </tr> 
  <tr>
  <td>年龄:</td>
  <td><input type="text" value="${stu.sage }"></input></td>
  </tr