Hi Mike, I hope the following isn't too basic for you!
With the Struts implementation of the MVC pattern (really Model-2) the View (JSP) gets
access to all the data it needs by accessing objects stored in the session context.
So, if the Action class wants to make data available to the JSP, it needs to first
store that data in the session context. Now, for the JSP to access it (or a custom
tag) all you need to know is the key under which the data was stored.
It is possible to store EJB references directly in the session context however this
would mean that the JSP/Tag would be using remote calls to get the data. This is not
really the best use of network resources so it is better for the Action class to put
simple JavaBean value classes into the session context. This might mean some amount
of copying data, but that should be minimal. If you follow this approach it might be
best if the SessionBean that the Action is using (you're not talking to EntityBeans
directly are you?) only return simple JavaBeans (as opposed to EJB's) to represent the
data.
Make sense?
--Steve
-----Original Message-----
From: Mike Thompson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 1:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Putting it all together, help???
/////////////////////////////////////////////////////////////////////////////////////////////////
Another point about your example above is that you are essentially going
to need some kind of object to hold your result data. Either you have all
fixed fields or some variable ones. So this is all a form requires you
to have. The struts taglibs make accessing this data in a relatively
uncluttered way very easy. They also obviate the need for you to write
your own taglib to encapsulate all the necessary java, or to have
unmaintainable scriptlets all over your jsps.
//////////////////////////////////////////////////////////////////////////////////////////////
Yes, I've already got a fairly extensive EJB backend, my only question was that I
won't be populating a form and since Struts is not a servlet engine, how does the HTML
get generated for my example.
In my actions perform method, I query some session EJBs for some data and would like
to display it in a table. Supposing I can get an iterator or collection of some sort,
how could I forward that to a jsp page so It could use the Struts tag lib tags for
iteration and display?
--m
P.S.
Thanks.