• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to reterive table row value (JSP )from the action class

 
Matt Swaggi
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am new to Struts 2 , please help me with the below scenario

I have a table in Jsp using struts2 tag , All I Want to do is to retrieve the selected(checked) table row's value in the action class.

Please let me know how to achieve it .


<s:iterator value="listOfDtos" status="stat">
<tr>
<td><s:checkbox name="delete" value="select" /></td>
<td><s:property value="FirstName"/></td>
<td><s:property value="LastName"/></td>
</tr>
</s:iterator>
<s:submit id="delete" value="delete"/>



"listOfDtos" is an array list od dto and is set in the action like the below
ActionContext.getContext().getValueStack().set("listOfDtos", listOfDtos);

Now when the user selects any row to be deleted I want to be able to first of all retrieve this list of dtos in the
Action and iterate them to check which of the dtos have the attribute "select" set to true.
"select" is an attribute of type String in the dto.

How can this be done ? also how will the "listOfDtos" be made available in the Action.

 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the action execution is done ActionContext data is no more available that is how struts2 framework is designed, for each and every request a new action instance will be created and it's holding it's own actionConext data that's why clean will happen after action execution, if you want that data store the data in session.
 
Matt Swaggi
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks Help me with this issue . ASAP please
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic