简体   繁体   English

来自数据超链接的struts2调用操作

[英]struts2 call action from hyperlink with data

I have page where i display the list of employees, their names. 我有一个页面,其中显示了员工列表及其姓名。 I need to have them as hyperlinks ans on click of A employee name i need to call another action say "detailsAction". 我需要在单击雇员姓名时将其作为超链接ans,我需要调用另一个动作,例如“ detailsAction”。 This action will get data about this employee from that DB and display the same in a page. 该操作将从该数据库获取有关该员工的数据,并在页面中显示该数据。 How do i send the employee id associated with the hyperlink that the user clicked to my "detailsAction" ?? 如何将与用户单击的超链接关联的员工ID发送到我的“ detailsAction”?

Right now the employee list is done below in my jsp page 现在,员工列表在我的jsp页面中完成

<s:if test="empList">
 <table>
  <tr>
    <th>Employee Name</th>
   </tr>
  <s:iterator value="empList">
  <tr>
     <td><s:property value="empName" /></td>
  </tr>
  </s:iterator>
</table>
</s:if>

You can use the Struts tags for that: 您可以为此使用Struts标记:

    <s:a href="/whateverAddress" >
        <s:text name="Link text goes here"/>
        <s:param name="param1" value="value1"/>    
    </s:a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM