I went back to the servler way...

Enumeration parameterNames =
ServletActionContext.getRequest().getParameterNames();

while(parameterNames.hasMoreElements()) {
        String parameterName = (String)parameterNames.nextElement();
        if(parameterName.startswith("someName")) {
                        String parameter =
ServletActionContext.getRequest().getParameter(parameterName);
                .....
        }
}

and then in the velocity template used the $velocityCounter to index my
dynamic fileds, like;
#foreach($num in [1..$numberOfFields])
        <input type="text" name="someName_${num}">
#end


David


On Mon, 2004-01-26 at 17:23, Les Stroud wrote:
> Does anyone have an example like this working?  For instance, if you
> have a String[], do I also have to have another one on the page for the
> names of the fields so that I can map them back to the appropriate
> properties in the db?
> 
> 
> LES
> -----Original Message-----
> From: David Nielsen [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, December 10, 2003 4:47 AM
> To: webwork-list
> Subject: RE: [OS-webwork] Dynamic text fields
> 
> Cool just what i was looking for thanks..
> 
> Is the order in the array the order the page is printed, so i can trust
> that the first text field is the string[0]  ?
> 
> Regards David
> 
> 
> 
> 
> On Tue, 2003-12-09 at 16:57, Patrick Lightbody wrote:
> > David,
> > In WebWork 1.x and 2.0, you can provide a get/set method for a
> String[]
> > and then name each textfield the same name.
> > 
> > Alternatively, in 2.0, you can name your textfields "foo[i].name"
> where
> > i goes from 0 to n. This will work if you use the OgnlList, which will
> > be included in to WebWork code shortly. The only catch is that WebWork
> > needs to know what class type is going to be in the list. I haven't
> yet
> > figured out how to handle that yet, but it should be in place in the
> > next day or two since I need this functionality myself :)
> > 
> > -Pat
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
> > David Nielsen
> > Sent: Thursday, December 04, 2003 4:37 AM
> > To: webwork-list
> > Subject: [OS-webwork] Dynamic text fields
> > 
> > Hi.
> > 
> > Im a little stuck with some dynamic added text fields.
> > 
> > i have a webwork template with the following in it:
> > 
> > #foreach($textField in $allTextFields)
> >     <input type="text" name="$textField.getName()"
> > value="$textField.getValue()">
> > #end
> > 
> > i have a getAllTextFields method in my Action class that returns a
> > Vector of my own TextField classes, that have getName() & getValue()
> > methods
> > 
> > now i need to submit the form, but the Action class doesnt have
> get/set
> > methods in all the textfield names, because they are dynamicly added.
> > 
> > does anyone know a solution how i dynammicly can add text fields and
> be
> > able to submit them to the action ?
> > 
> > Regards David
> > 
> > 
> > 
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive?  Does it
> > help you create better code?  SHARE THE LOVE, and help us help
> > YOU!  Click Here: http://sourceforge.net/donate/
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> > 
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive?  Does it
> > help you create better code?  SHARE THE LOVE, and help us help
> > YOU!  Click Here: http://sourceforge.net/donate/
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to