Search code examples
javajavascriptjspstrutsel

How to send a parameter with an action URL from struts tag in a table


I am populating some values in tag in struts 1 in a table.Now i want to send a value of that table with a URL which is a hyperlink of that table.i am able to call the action but i can not send the parameter with the URL.What I have done so far is,,

<script type="text/javascript" charset="utf-8">
        $(document).ready(function() {
            $('#metalPager').dataTable( {

                "bFilter":true,
                "aoColumns": [ 
                    { "bSortable": true },              
                    { "bSortable": true },
                    { "bSortable": true },                  
                    { "bSortable": true }                                           
                ]                   

            } );
        } );
</script>




<table width='70%' align="center" cellpadding="0" cellspacing="0" border="1" name="userSTPForm" id="metalPager">
    <thead>
    <tr>
        <th>STATUS</th>
        <th>SAPCODE</th>
        <th>FIRST NAME</th>     
        <th>LAST NAME</th>                          



    </tr>
    </thead>
    <tbody>
        <logic:iterate name="listOfSTPUsers" id="listOfSTPUsersId" >
            <tr>
            <td><bean:write name="listOfSTPUsersId"  property="value"/></td>
            <td><html:link href="exelunitUpload.do?action_name=" ><bean:write name="listOfSTPUsersId"  property="sapcode"/></html:link></td>
            <td><bean:write name="listOfSTPUsersId"  property="firstname"/></td>
            <td><bean:write name="listOfSTPUsersId"  property="lastname"/></td>                                         
            </tr>
        </logic:iterate>
    </tbody>


</table>

this is the action i am calling.Now if i want to send the stpcode with the URL what should i do?? somebody please help.


Solution

  • You are making a html link, you can use JSP EL to get the value of the parameter.

    <html:link href="exelunitUpload.do?stpcode=${listOfSTPUsersId.stpcode}" ><bean:write name="listOfSTPUsersId"  property="sapcode"/></html:link>