struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Navjot Singh" <navjo...@net4india.net>
Subject Re: How to get a reference to an ActionForm in a JSP
Date Wed, 09 Apr 2003 06:12:01 GMT
hi fernando,

if you give serious look to my second sugestion,
you should be able to do what you want.

HTH
- navjot singh

----- Original Message -----
From: "Fernando Jimenez" <fernando.jimenez@db.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Tuesday, April 08, 2003 7:34 PM
Subject: Re: How to get a reference to an ActionForm in a JSP


|
| Hi Navjot
|
| The JSP and the ActionForm are connected. I can display values stored in
the ActionForm using <html:text property="variableName">. However, I don't
know how to access those values directly. I want to do something like
"<%=myform.getSomething()%>" for example, where 'myform' would be the
instance of the ActionForm
|
| I've looked up and down but I just can't find how to do this, so if you or
anyone else could give me a quick hint, I would be most grateful
|
| Cheers
|
| FJ
| hi,
|
| Naturally, your jsp must have been connected to your ActionForm somehow.
All
| the variables of ActionForm should be automatically displayed to you.
|
| If NOT
| If you wish to have ActionForm object in your jsp, just write one line in
| your Action class -- request.setAtribute("carmodelform", carModelForm);
| oops, not a nice idea ;-)
|
| navjot
|
| ----- Original Message -----
| From: "Fernando Jimenez" <fernando.jimenez@db.com>
| To: <struts-user@jakarta.apache.org>
| Sent: Tuesday, April 08, 2003 5:21 PM
| Subject: How to get a reference to an ActionForm in a JSP
|
|
| | Hi
| |
| | I have a little bit of a dilema here, and I hope someone can help me
out.
| |
| | Here is what I'm trying to do:
| |
| | I'm trying to display a set of values in a table, where the user will be
| able to edit some fields in each row. So in each row, there is static
data,
| as well as some data he/she will be able to modify.
| |
| | I thought I would put all the data, static and user modifiable, in an
| ActionForm, to keep it all in one place.
| |
| | Now, I'm not too sure of what the best way to go on about this would be.
I
| could either use a Map-backed ActionForm, and put all the data in one
single
| Map. Then I would have to, somehow, get a list of something to index this
| map. So if I had a list of carmodels, and characteristics, I could have a
| list of carmodels, and then access the map with keys such as
| carmodel+"enginesize", carmodel+"colour", and so on
| |
| | Or I could store each characteristic on a different map, and then index
| each map by carmodel.
| |
| | Now, the questions are:
| |
| | - How and where would I store the list of "carmodels" in this example? I
| could store it in the session, but would it be possible to store it in the
| ActionForm?
| | - If stored in the ActionForm, how could I get a reference to the action
| form so that I could get the list in the JSP to cycle through it and build
| the table?
| |
| | If I could get a reference to the ActionForm in the JSP, I could then
| access my static data easily to display it in the table. At the moment, I
| have to put my static data in the session (such as the list of keys
| (carmodels in the example)), and retrieve the dynamic data using struts
tag
| libraries such as <html:text property="engine(carmodel">.  But I think
this
| is a bit messy.
| |
| | Any help, hints, or ideas would be much appreciated
| |
| | Oh, sorry if my question(s) are a bit obvious. I'm just starting with
| struts
| |
| | Thanks
| |
| | FJ
| |
| |
| | --
| |
| | This e-mail may contain confidential and/or privileged information. If
you
| are not the intended recipient (or have received this e-mail in error)
| please notify the sender immediately and destroy this e-mail. Any
| unauthorized copying, disclosure or distribution of the material in this
| e-mail is strictly forbidden.
| |
| |
| |
| | ---------------------------------------------------------------------
| | To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| | For additional commands, e-mail: struts-user-help@jakarta.apache.org
| |
| |
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|
|
|
|
|
| --
|
| This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message