You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajat Nayer <ra...@yahoo.com> on 2003/06/20 10:48:56 UTC

accessing VO by next view...

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



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: accessing VO by next view...

Posted by Rajat Nayer <ra...@yahoo.com>.
Thanks David,

Would it possible to get some code snippets for Action
class (wherein it populates the Collection and places
it in session scope) and that of the JSP which
displays this information.

-R



--- David Bolsover <ju...@bolsover.com> wrote:
> Typically, the VO is used to populate a collection(
> eg ArrayList - Vectors not
> usually used) of FormBeans and this is saved in some
> HttpServletRequet scope -
> most frequently request scope - although for 'User'
> type data it is often
> convenient to store this in session scope.
> 
> Once you have your collection of FormBeans in scope,
> you use the Struts (and/or
> JSTL) tag libraries in the DetailPage.jsp to access
> the fields of the FormBeans
> 
> db
> 
> 
> -----Original Message-----
> From: Rajat Nayer [mailto:raj32nay@yahoo.com]
> Sent: 20 June 2003 09:49
> To: Struts Users Mailing List
> Subject: accessing VO by next view...
> 
> 
> 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
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: accessing VO by next view...

Posted by Sandeep Takhar <sa...@yahoo.com>.
Let's say you have a link on a page that is

/doSomething.do?id=2

This goes to an action that pulls the id and reads
from the database and gets a DTO.

Now you can do one of two things.  You can use
beanUtils.copyProperties to your form which has the
same names as the properties from your DTO, or you can
just place the resulting DTO or collection or whatever
into request scope and then forward to "success" which
is your jsp (or better yet your tile definition).

Your jsp just iterates over the collection using
nested tags and struts-el.  The nested:form
action="/doSomethingElse.do" method="post" will tell
where the form will be submitted.

This question is simple, but there are many paths to
follow...

sandeep
--- Rajat Nayer <ra...@yahoo.com> wrote:
> Dear All,
> 
> Please respond.. I was expecting some good
> hand-holding support here.
> 
> regds
> Rajat
> --- David Bolsover <ju...@bolsover.com> wrote:
> > Typically, the VO is used to populate a
> collection(
> > eg ArrayList - Vectors not
> > usually used) of FormBeans and this is saved in
> some
> > HttpServletRequet scope -
> > most frequently request scope - although for
> 'User'
> > type data it is often
> > convenient to store this in session scope.
> > 
> > Once you have your collection of FormBeans in
> scope,
> > you use the Struts (and/or
> > JSTL) tag libraries in the DetailPage.jsp to
> access
> > the fields of the FormBeans
> > 
> > db
> > 
> > 
> > -----Original Message-----
> > From: Rajat Nayer [mailto:raj32nay@yahoo.com]
> > Sent: 20 June 2003 09:49
> > To: Struts Users Mailing List
> > Subject: accessing VO by next view...
> > 
> > 
> > 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
> > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: accessing VO by next view...

Posted by Rajat Nayer <ra...@yahoo.com>.
Dear All,

Please respond.. I was expecting some good
hand-holding support here.

regds
Rajat
--- David Bolsover <ju...@bolsover.com> wrote:
> Typically, the VO is used to populate a collection(
> eg ArrayList - Vectors not
> usually used) of FormBeans and this is saved in some
> HttpServletRequet scope -
> most frequently request scope - although for 'User'
> type data it is often
> convenient to store this in session scope.
> 
> Once you have your collection of FormBeans in scope,
> you use the Struts (and/or
> JSTL) tag libraries in the DetailPage.jsp to access
> the fields of the FormBeans
> 
> db
> 
> 
> -----Original Message-----
> From: Rajat Nayer [mailto:raj32nay@yahoo.com]
> Sent: 20 June 2003 09:49
> To: Struts Users Mailing List
> Subject: accessing VO by next view...
> 
> 
> 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
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: accessing VO by next view...

Posted by David Bolsover <ju...@bolsover.com>.
Typically, the VO is used to populate a collection( eg ArrayList - Vectors not
usually used) of FormBeans and this is saved in some HttpServletRequet scope -
most frequently request scope - although for 'User' type data it is often
convenient to store this in session scope.

Once you have your collection of FormBeans in scope, you use the Struts (and/or
JSTL) tag libraries in the DetailPage.jsp to access the fields of the FormBeans

db


-----Original Message-----
From: Rajat Nayer [mailto:raj32nay@yahoo.com]
Sent: 20 June 2003 09:49
To: Struts Users Mailing List
Subject: accessing VO by next view...


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



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org