0

I have a table that displays a collection using the iterator tag. Last column of each row has a tag that will trigger an ajax action call. The result targets a . My problem is that I would like to have the ajax response in the next column of the row that triggers the ajax call withing the table. The ajax response using the following code puts the result into the last column of the first row of the table.

The code is something like this:

<s:iterator value="orderBO.lineItemBOcollection">
    <tr>
        <td><s:property value="itemNumber"/></td>
        <td><s:property value="itemDescription"/></td>
        <td align="center"><s:property value="quantity"/></td>
        <td align="center">
            <s:url id="ajax" action="Orders!searchCurrentSalesPrice"></s:url>
            <sx:a href="%{ajax}" targets="divtarget" >View</sx:a>
        </td>
        <td>
            <sx:div id="divtarget"></sx:div> 
        </td>
    </tr>
</s:iterator>

What I need is to be able to get the ajax response in the last column of the specific row that triggers the ajax call.

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • Avoid using DMI (`!searchCurrentSalesPrice`) that is considered a bad practice and an invite to attackers, and also avoid struts-dojo tags; if you must use tags, use the struts2-jquery one, [like you did the last time](http://stackoverflow.com/q/25857199/1654265), otherwise use raw jQuery, or another 3rd party library, or vanilla JS – Andrea Ligios Feb 25 '15 at 17:32
  • Thanks. How can I call an action method avoiding DMI? – Giuseppe Pellegrino Feb 25 '15 at 17:47
  • http://stackoverflow.com/a/20746720/1654265 . In the example the action mapping is made using Convention annotations, but it's equals to the XML config. – Andrea Ligios Feb 25 '15 at 17:51
  • Could you clarify how the specific row is supposed to trigger the ajax call? – Roman C Feb 25 '15 at 19:36
  • Its just a link that triggers the ajax call. What I am looking is to get the reply (or ajax response) in the column next to the row that triggered the ajax call. I am using to get the ajax response; the issue is that the response is shown always in the first row of the table and I need the response in the specific row that originally triggered the ajax call. – Giuseppe Pellegrino Feb 26 '15 at 20:10

0 Answers0