From: "Anna Kerekes" <[EMAIL PROTECTED]>
> I have a jsp (create.jsp), a form-bean (CreateMessageForm.java),
> and an action (CreateMessageAction.java).
> Currently, the user inputs their info into create.jsp, hits 'submit',
> and the action gets the info from the form-bean
> and does stuff with it.  Instead, I would like to get some information(
collections)
> from a database and populate "create.jsp" with them. So I would like to:

If you're talking about pre-populating form elements with default values,
the solution involves never letting people go directly to your JSP, but
instead ALWAYS making them go through an Action.  That's where you
prepopulate the form bean, and doing that means that when you forward to the
JSP containing Struts tags, the values will automatically be displayed.

If you're talking about Collections that become the list of options for a
<select> list, then those are appropriate to put in request or session
scope, or even application scope if they will be the same for all users.  I
have a  context listener that places a bunch of Maps in application scope,
and a Filter that places things in the request.

Either way, once you stop letting people go directly to your JSP, and ALWAYS
make them go through an Action, you suddenly have the opportunity to do any
set-up work you need to do before forwarding them to the JSP.

-- 
Wendy


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

Reply via email to