Question

I am using the struts2 iterator tag to list the complaints the user creates. The user should be able to select the link that sends the user to a page with more details on the complaint. While going to the next page works, I do not know how to bring the complaint ID to the new page.

//.jsp Code
<table>
    <tr>
        <td><strong>Complaint #</strong></td>
        <td><strong>Current Status</strong></td>
    </tr>
    <tr>
        <td><a href="<s:url namespace="/staff" action="complaintDetails"/>"><s:property value="cmplntNumber"/></a></td>
        <td>currentStatus</td>


//struts.xml
<action name="complaintDetails" class="complaintInformation" method="complaintDetails">
    <result name="complaintDetails">/complaintDetails.jsp</result>
</action>

Now I can successfully get to the complaintDetails.jsp, I just need to get the specific complaint Id that the user selected.

Was it helpful?

Solution

Pass the complaint id using <s:param> as

<td><a href="<s:url namespace="/staff" action="complaintDetails">
        <s:param name="compNum" value="%{cmplntNumber}" /></s:url>">
        <s:property value="cmplntNumber"/>
    </a>
</td>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top