So, you are calling your ejb or delegate class from your formbean to get the
static data?  And how do you access it from the jsp? I am just curious.

-----Original Message-----
From: Marcelo Vanzin [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 22, 2002 1:05 PM
To: Struts Users Mailing List
Subject: Re: Where is it best to populate default form bean collections et
c?

Hoang, Hai wrote:
> I've been using the Action classes to load the required data for the form
> and place it under session object if the data does change often and the
> dropdown is being used repeatedly. ...  Just be sure to remove these
collections from the
> session object when you are done.

        The "clean up" part is tricky, because you can't be sure of when the
data 
can be cleaned up, and you can't rely on the user to click somewhere 
that'll fire an action to make that cleanup...

        Around here, because we have lots of "static" data on the pages and 
querying the remove server (EJB) for these data would be very onerous, 
we do the following:

        - All our form beans are in the session scope. This way, we populate
them 
with the necessary collections and other data needed for the JSP, and we 
don't need to re-populate this data in later requests from that user.

        - No data is stored outside the form bean. Everything on the JSPs is

loaded from the form bean.

        - On each request, we look for the objects stored in the user's
session 
and, in case it is a form bean but is not the form bean of the current 
request, it is deleted.

        The last part may seem "heavy" since in every request I loop through

everything in the session, but, due to the way we implemented 
(everything in the bean) we generally have 2 or 3 objects in the session 
(the form bean, the "Locale" object and the "token" for preventing 
repeated requests from being processed).

        Also, we have some mechanisms for when we do not want a form bean to
be 
erased from the session (since all our forms use session scope, there 
are times when we may need more than one bean in the session).

        It may not be the most beautiful thing to do, but it has been
working 
very well. =)

-- 
[]'s
Marcelo Vanzin
Touch Tecnologia
[EMAIL PROTECTED]
"Life is too short to drink cheap beer"


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to