Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

VO issue - Struts question!!

 
Rajat Nayer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!!
I am a newbie to struts.
I want to validate my undertsanding of the basic
Struts framework viz a viz the VO issue that i will explain thereafter.
My understanding of the flow using struts and EJB is as follows:
Browser -> ActionServlet -> populates FormBean and
instantiates the Action Class (based on
struts-config.xml entries)->calls EJB-> calls DAO->accesses DB.
The DAO creates a VO that is passed back to the EJB which in turn passes it back to the Action class.
Now, How is this VO data used by the next view (JSP)defined. What is the mechanism?
For eample, in page1.html I have an id which is passed all the way to the DAO. The DAO fetches the data from the DB based on this ID and returns a collection (maybe a vector of objects/resultset).
Now how does the next page i.e. the DetailPage.jsp get this data and how to use this to show it in a tabular form.
I know it is a very basic question.. would appreciate an easy to understand(newbie context) answer.
Thanks in advance,
Rajat
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Struts Forum - also known as the Frameworks Forum .
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The DAO creates a VO that is passed back to the EJB which in turn passes it back to the Action class.
Now, How is this VO data used by the next view (JSP)defined. What is the mechanism?

Hi there,
There are a number of things you can do at this point:
1. You can have the DAO method or Action class store the VO in the request object. The resulting JSP can then retrieve the contents of the VO bean as appropriate.
2. If you wish to pre-populate a form with the contents of the VO class, you can use the DAO method or action class to create a new form bean and populate its attributes with values in the VO object. As long as the form bean is associated with the target JSP page via the action mappings in the struts-config.xml file, the JSP page should render it no problem.
Just two of the many options available!
Cheers,
Darryl
 
Rajat Nayer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the other options.
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajat,
There's no finite list to choose from. You use them as dictated by your needs, chosen architecture, programming style, etc.
Darryl
[ June 26, 2003: Message edited by: Darryl A. J. Staflund ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic