struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: dynamically generating user input fields
Date Wed, 25 Feb 2015 13:43:13 GMT
Increment a counter?
On Feb 25, 2015 7:42 AM, "Yaragalla Muralidhar" <yaragallamurali@gmail.com>
wrote:

> Actually i have a "List<Student> students "  in my action class. but when i
> am dynamically genaerating fields in html page how to change the names of
> the fields that are dynamically getting generated?   for the first field i
> gave students[0].name but for the second field that is dynamically getting
> generated how can i change the name of the field like "students[1].name?
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>
> On Wed, Feb 25, 2015 at 5:51 PM, Christoph Nenning <
> Christoph.Nenning@lex-com.net> wrote:
>
> > > Hi i have a jsp page with a button "capture student details". when that
> > > button is pressed it has to display few user input fields on the same
> > page
> > > like "student Name", student id and few other fields . now user enters
> > the
> > > details of the student and when he press the button again the same set
> > of
> > > fields have to appear again in order to capture the 2nd student
> details.
> > > how to achieve this?
> > >
> > >
> >
> >
> > As member of your action you can use a Map<String, String>. The Map-Key
> is
> > the dynamic field name. You need some JS to generate a new input-field in
> > the browser. As html-input-name you can use an OGNL expression like
> > "map['fieldName']". That way struts can set the keys and values in your
> > action's map.
> >
> >
> >
> > Regards,
> > Christoph
> >
> > This Email was scanned by Sophos Anti Virus
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message