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

struts2如何解决这个问题?
一个jsp页面,在s:form里输入查询条件,提交后在action里查询数据库,然后在页面显示查询

结果。下面是jsp部分代码:
<body>
  用户信息管理<br>
  <s:form action="userEdit" method="post" >
  <s:select name="searchMode" label="查询内容"
  list="#{'1':'全部用户',
  '2':'用户名'
  }"  
  labelposition="top" />  
  <s:textfield name="userName" key="user" label="用户名" />
  <s:submit value="查询" />
  </s:form>
   
   
  <s:if test="#request.checkState=='success'">
  <table width="700" border="1" >
  <tr>
<td width="20%"><div align="center">用户名</div>
</td>
<td width="20%"><div align="center">密码</div>
</td>
<td width="20%"><div align="center">部门主管</div>
</td>
<td width="20%"><div align="center">用户状态</div>
</td>
<td width="20%"><div align="center">用户所属部门</div>
</td>  
</tr>  
<s:iterator value="#request.Array" id="stru" status="oddLine" >
<tr <s:if test="#oddLine.odd">style="background-

color:#bbbbbb"</s:if> >
<td><s:property value="userName"/></td>  
  <td><s:property value="passWord" /></td>
  <td><s:property value="leaderFlag" /></td>
  <td><s:property value="status" /></td>
  <td><s:property value="userType" /></td>
</s:iterator>
  </table>  
   
  </s:if>  
   
  </body>

问题:我想在用户列表的用户名这里<td><s:property value="userName"/></td>做个链接,当

点击用户名时,弹出新页面,在新页面里显示这个用户的详细信息。那么用strust2怎么实现当

前的用户名参数传到下个页面,并在下个页面打开的时候就显示对应信息呢?参数如何传?这

两个action怎么做?
谢谢!

------解决方案--------------------
<td> <s:a href="actionName.action"><s:property value="userName"/></s:a> </td> 

------解决方案--------------------
struts2中要获取页面参数值在页面内必须要有对应的的属性

如果要使用request可以使用ServletActionContext得到

其他的和struts1.x相同 处理方式也一样
------解决方案--------------------
<a href='<s:url action="actionName.action"><s:param name="userName" value="userName" /></s:url>'>
<s:propery value="userName"/>
</a>
------解决方案--------------------
探讨
<a href=' <s:url action="actionName.action"> <s:param name="userName" value="userName" /> </s:url>'>
<s:propery value="userName"/>