Hi there,
But how do you get an ActionForm to populate? If I'm on page X, trying to
get to page Y, I would need the ActionForm for Y, and all I have in my
execute method is the ActionForm for X.
Mike
----
Mike Boucher [EMAIL PROTECTED]
Edgil Associates www.edgil.com
"Don't take life too seriously, you'll never get out of it alive!"
"Robert
Nocera" To: "'Struts Users Mailing List'" <[EMAIL
PROTECTED]>
<[EMAIL PROTECTED] cc:
llc.com> Subject: RE: Filling data in the select
tags
01/19/2004
12:37 PM
Please
respond to
"Struts Users
Mailing List"
The ActionForm is also used to display data on the JSP, so the method that
Andrew describes is a good way to go about it. When the user requests to
go
to a page, make sure that request is to an action and not directly to a
jsp.
As Andrew mentioned he has done, I have also moved from using separate
beans
to display data to using the ActionForm to hold the display data. If you
consider the ActionForm as just a piece of the view, it makes perfect
sense.
The only time I go outside the ActionForm is when I need to display a list
of items, say for a dropdown selection, in that case I'll just set the list
in the request separately.
-Rob
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, January 19, 2004 11:43 AM
To: Struts Users Mailing List
Subject: RE: Filling data in the select tags
Hi folks,
I'm also new to struts, and setting any fields before the page is displayed
is something that I'm having trouble with.
Here's a few things I need to do.
1) A user logs in to the application. I need to display the login name on
every page of the application.
2) After one page, some processing is performed, and a result code is
displayed to the user on the subsequent page.
How do I get this data to display on my page?
Below, Andrew says that you can put the info in the actionForm, which is
where it makes sense to me to have it. But I can't figure out how to even
do that. It would make sense to populate an actionForm and send it to the
request, but everything I've seen suggests that the actionForm is created
upon submit, and not used for input.
I'm just horribly confused...
Thanx for any help.
Mike
----
Mike Boucher [EMAIL PROTECTED]
Edgil Associates www.edgil.com
"Don't take life too seriously, you'll never get out of it alive!"
"Andrew Hill"
<[EMAIL PROTECTED] To: "Struts Users
Mailing List" <[EMAIL PROTECTED]>
dnode.com> cc:
Subject: RE: Filling
data in the select tags
01/19/2004 07:33 AM
Please respond to
"Struts Users Mailing
List"
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]