struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takhar, Sandeep" <Sandeep.Tak...@CIBC.ca>
Subject RE: when not to use an ActionForm
Date Thu, 15 Apr 2004 11:45:08 GMT
Excellent link!

There is another option:

   1) LazyValidatorActionForm:
            http://www.niallp.pwp.blueyonder.co.uk

sandeep

-----Original Message-----
From: Oswald Campesato [mailto:ocampesato@yahoo.com]
Sent: Wednesday, April 14, 2004 11:39 PM
To: Struts Users Mailing List
Subject: Re: when not to use an ActionForm


Hello, Martin/Andy:
 
I'd like to suggest using JSTL for this type of scenario.  You can find a 
nice explanation at the following URL (my compliments to its author):
 
http://jakarta.apache.org/struts/faqs/indexedprops.html

Regards,
 
Oswald
 
Note:  I also downloaded the tag-libs project, because the solution outlined 
in the preceding URL requires both jstl.jar and standard.jar, which contains
org/apache/taglibs/standard/lang/support/ExpressionManager.class
 

Martin Cooper <martinc@apache.org> wrote:

"Andy Engle" wrote in message
news:20040414225317.90035.qmail@web41504.mail.yahoo.com...
> Vijay.Kukreja@siriuscom.com wrote:
>
> > Richard,
> > Its not necessary to use ActionForm, but it is always better to use
> > one(its my philosophy). But yes it will work the way you are doing
> > it. But i rather prefer a ActionForm which can also help in future
> > for any validation or in future if decided to add more attributes to
> > the form..
>
> With this discussion in mind, I am wondering if there is any way I can
> use an ActionForm in the following scenario: I would like to have a
> list of fields, dynamically created, with names that have been
> dynamically created along with those fields. So, for example, I would
> have a series of input fields like this:
>
>  [input] 
>  [input] 
>  [input] 
>
> The "field_" part of the name value will stay, but the number will
> change. With these field name values being so dynamic, is there any
> trick I can use to feed all this into an ActionForm? I don't think
> there is, unless I am missing something...

I don't believe it can be done with the fields named like that, but there is
a trick you might be able to use. ;-)

1) In the  [input]  elements, use names of the form "dynaFields.field_1", etc.
The name isn't important, but the dot is.
2) Create a corresponding Map property in your form bean (i.e. a property
named "dynaFields" in this example).

When your action form is populated, you will end up with the "dynaFields"
map containing key/value pairs corresponding to the name/value pairs from
your  [input]  elements.

--
Martin Cooper


>
>
> Thanks,
> Andy




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

		
---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

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


Mime
View raw message