struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sayre" <richardsa...@gmail.com>
Subject Re: Invoking action method from javascript
Date Fri, 29 Feb 2008 15:20:15 GMT
you can say, document.location.href = '<s:url
action="myRemoveAction">?myId=' + myId;

This will cause the whole page to refresh, so you should probably have
a prepare method if you have any data that needs to be populated on
that page (ie your table).

I personally would use Ajax to make the call, having a full page
refresh on each click could be annoying to the user.

Rich



On Fri, Feb 29, 2008 at 11:01 AM, Paranoid_Fabio
<paranoid_fabio@yahoo.it> wrote:
>
>  Hello. I've an action that populates a table with some info. In each row,
>  there's a button to delete the entry and the associated object from the DB.
>  In my action class I've a list (something like a queue) of the ID that will
>  be removed after the user clicks on the "apply" button.
>  So, all I want to do, is to add each element ID the user selects to the
>  "remove-queue". When the user clicks on the remove icon, a javascript
>  function is called:
>
>  the jsp snippet:
>
>  <td> ')" >
>          ../pages/Images/edit_remove.png </img>
>  </td>
>
>  the script inside the JSP.
>
>  <script type="text/javascript">
>                  function addToRemoveList(id){
>
>                  }
>  </script>
>
>  The script is correctly invoked and the paramater ID is correctly passed.
>  Now i would like to call a method of my action class and to refresh the
>  page. Something like:
>
>  <script type="text/javascript">
>                  function addToRemoveList(id){
>
>                         myCurrentAction.addItemToRemove(id)
>
>
>                  }
>  </script>
>
>  is it possible? thank you very much
>
>
>  --
>  View this message in context: http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15759459.html
>  Sent from the Struts - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message