You would look up thge information (form the db or whatever) in an Action
that precedes the view. This (setup) action obtains all the necessary
dynamic info that the view (JSP) will need to render the view with, it then
forwards to the view page.

As you say, you have several options for where to put the info. You could
store it directly in request attributes, your could put it all together in a
bean in the request, or you could add it to the actionForm. Speaking for
myself these days I find myself gravitating towards using the actionform for
this sort of thing (I used to keep it quite seperate but nowdays am
favouring the opposite point of view!) thinking of the the actionform, not
so much as a mere input buffer, but more as a representation of the UI state
for that page. One could nest the the ui info in a bean in the actionform to
clearly delineate it from the input properties (and perhaps build safegaurds
into the setter so it can be called by processPopulate!)

Id be interested to hear what other members of the list have to say about
best practice in this.

Using the session has the advantage that you would only need to go through
the setup action once so for things like wizards this can be useful.
(Storing in the form, and having the form in session gives same effect of
course, plus the advantage that you can change the scope of the lot from a
single attribute in struts-config!)

-----Original Message-----
From: Florin Pop [mailto:[EMAIL PROTECTED]
Sent: Monday, 19 January 2004 20:12
To: '[EMAIL PROTECTED]'
Subject: Filling data in the select tags


Hi there,

I am new to Struts and I am wondering how can I handle the following
situation: I have a form where I have some fields for entering user data.
Some of the fields are combo boxes (<select> in html), for example a list of
countries. My question is how can I fill the data in the countries combobox?
Where should I store the data required for filling the combo? In the
ActionForm or should I put it into another bean which is stored in the
session or in the request?
where should I fill the list with the countries in an Action class?

Thanks in advance,

Florin

---------------------------------------------------------------------
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