You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt <cs...@gmail.com> on 2012/02/08 21:31:24 UTC

How to reterive table row value in Struts2 action ( From JSP To Struts Action )

I am kind of new to Struts2 , please help me with the below scenario .  

Here is the scenario. First search action is invoked. So here is the place
where I can have ArrayList called as the "listOfDtos" with getters and
setters. When this search action is executed listOfDtos is populated and the
search results jsp iterated through these dtos and displays it. Now the user
selects couple of records and clicks a button called delete. The delete
button is tied to a separate action called DeleteAction. So now the
listOfDtos is not available in this DeleteAction. Even if I again have
another listOfDtos defined in DeleteAction , how will those values be
populated ?

--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-reterive-table-row-value-in-Struts2-action-From-JSP-To-Struts-Action-tp5467605p5467605.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


Re: How to reterive table row value in Struts2 action ( From JSP To Struts Action )

Posted by Dave Newton <da...@gmail.com>.
You don't need a list of the items, you need a list of IDs to delete.

You can either make the checkboxes all have the same name and create a List
setter, or use map notation and use the ID as the key. In the delete action
pass those IDs to your delete service/DAO.

Dave

On Wed, Feb 8, 2012 at 3:31 PM, Matt <cs...@gmail.com> wrote:

> I am kind of new to Struts2 , please help me with the below scenario .
>
> Here is the scenario. First search action is invoked. So here is the place
> where I can have ArrayList called as the "listOfDtos" with getters and
> setters. When this search action is executed listOfDtos is populated and
> the
> search results jsp iterated through these dtos and displays it. Now the
> user
> selects couple of records and clicks a button called delete. The delete
> button is tied to a separate action called DeleteAction. So now the
> listOfDtos is not available in this DeleteAction. Even if I again have
> another listOfDtos defined in DeleteAction , how will those values be
> populated ?
>
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/How-to-reterive-table-row-value-in-Struts2-action-From-JSP-To-Struts-Action-tp5467605p5467605.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
>
>