Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing an object to action class

 
sivaraman subbiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a requirement like

1. I have a List<someDO> resultList; in my form bean.
2. In the jsp, I search based on certain criteria and in the action class, i set the the list in the form bean
3. Using <logic:iterate> i display the resultList in a table.
4. In each row of the table, I have an edit (link or button) .
5. On clicking the edit (link or button), I want to pass the whole object (DO) to the action class so that i can show a separate Edit jsp with all the corresponding values populated.

How to do it??

solution needed urgently. Thanks in advance
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include some data that will identify the DO in the link to the DO edit action. This is usually the primary key of the DO in the database. In the action which populates the DO edit form, read the DO from the database.
 
sivaraman subbiah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe. But is there some way to pass the bean as such through html:link , or any other way like setting the bean in request scope inside the logic:iterate itself ??
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope.
See The Secret Life of JavaServer Pages by Bear Bibeault

If you are using a component based framework like Wicket or Tapestry, you could write code like that, because they do a lot of 'magic' under the covers to hide the request - response nature of HTTP. But Struts or other action based frameworks don't provide this kind of functionality.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic