日期:2014-05-18  浏览次数:20592 次

struts2 中jsp页面如何将传值action 值传递给另一个jsp
sorry.jsp

<body>
 
  sorry  
  please <a href="<s:url value="/register.jsp"/> ">try again</a>
</body>
</html>


register.jsp

<body>
  <s:form action="registerAction">
      <s:textfield name="personBean.firstName" label="First name" tooltip="Enter your name"/>
    <s:textfield  name="personBean.lastName" label="Last name" />
    <s:textfield name="personBean.email"  label ="Email"/>  
    <s:textfield name="personBean.age"  label="Age"  />
    <s:submit/>
    </s:form>
    <s:debug></s:debug>
</body>
</html>

如何在register.jsp获得原来输错的值
希望通过 action获取

------解决方案--------------------
在action 中注入personBean
------解决方案--------------------
在action中维护一个personBean对象,提供getter()、setter()方法,这样在返回的时候,action中的属性会被压到valueStact的栈顶,可以直接取出.