struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paranoid_Fabio <paranoid_fa...@yahoo.it>
Subject Re: Invoking action method from javascript
Date Fri, 29 Feb 2008 15:31:44 GMT

Thank you. In fact I don't have a removeAction, but only a removeMethod() in
the same action that display and populate the list. Because I don't want to
remove the element from the DB on click, I only want to add the clicked ID
to a remove queue. Then all the remove queue will be processed by a
removeAction when the user confirms the changes. So image a table with rows
and a "delete" icon for each row. When the user clicks the "delete" icon of
a row, the ID of the row must be pushed into the queue (a property of my
action) and the row should change color.
I don't want to invoke a removeAction for every click...but I think it's the
only way..isn't it?

I also thought about a solution like: 

keep the queue in the session and user a removeAction for each click that
simply add the ID to the queue in the session, and invoke again the
ListAction that populates and list the table...and so on.
In this case I could use <s:div> with target to refresh only the table.




Paranoid_Fabio 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-tp15759459p15760910.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


Mime
View raw message