aspose file tools*
The moose likes Struts and the fly likes VO issue - Struts question!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "VO issue - Struts question!!" Watch "VO issue - Struts question!!" New topic
Author

VO issue - Struts question!!

Rajat Nayer
Greenhorn

Joined: Feb 11, 2002
Posts: 21
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

Joined: Sep 29, 2000
Posts: 8521
Moving to the Struts Forum - also known as the Frameworks Forum .


"JavaRanch, where the deer and the Certified play" - David O'Meara
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303

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

Joined: Feb 11, 2002
Posts: 21
what are the other options.
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: VO issue - Struts question!!