For load your default values at aplication startup you can create a
HttpServlet,  and load data from database and store  in application scope.
In struts 1.1 instead of HttpServlet you can create a Struts plugin to do
the same.

second, when a user need access to one "use case" with default data, create
an action that populate your form with data stored in application scope.

"Curtney Jacobs" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Greetings Carlos. Thanks for replying.
>
> Yes. I can populate a form that way. However, it wouldn't quite give me
what I
> want. For instance, as the application is initially loaded there should be
> default values already in the forms; this should be done prior to any user
> action.
>
> I like your one action approach. Is there a way to call this action as the
> application is initially loaded. Again, no user interaction should trigger
> this action class.
>
> Thanks,
>
> Curtney
>
> On Monday 04 August 2003 05:09 pm, Aguirre Carlos Federico wrote:
> > if you need to populate a form, you can do in one action
> > and then forward to jsp, why you need to pre-populate ??
> >
> > "Curtney Jacobs" <[EMAIL PROTECTED]> escribió en el mensaje
> > news:[EMAIL PROTECTED]
> >
> > > Greetings everyone!
> > >
> > >
> > > I would like to preopulate serveral forms with default values retrieve
> >
> > from a
> >
> > > database upon application startup or after a successful login by the
> > > user.
> > >
> > > I have an approach in mind, however, I am not sure if it is the most
> >
> > efficient
> >
> > > or best approach. My approach is to use a filter that creates and
stores
> >
> > in
> >
> > > memory default ActionForms. The ActionForm will contain default values
> > > for select fields (or any other fields) retrieved from a database. The
> > > ActionForms will be stored within the current user session and then
> >
> > controll
> >
> > > will be given over to Struts ActionServlet.
> > >
> > >
> > > Another similar approach would be to register a listerner
> > > (HttpSessionAttributeListener) that would essentially  wait for a
> > > specific attribute to be added into the session (i.e SETUP_FORMS) then
it
> > > would
> >
> > query
> >
> > > the database for neccessary application setup data.
> > >
> > >
> > > I read the message archive, and a few have suggested calling a "setup
> >
> > action"
> >
> > > per request that prepopulates the default values in the ActionForm.
This
> >
> > is a
> >
> > > valid approach, but IMHO only for small applications. It just seems
that
> > > there will be to much "traffic" going on between the app and the
> > > database. Correct me if I am wrong.
> > >
> > > If you have gotten this far please share your thoughts on this topic.
> > >
> > > Curtney
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]




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

Reply via email to