• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JSTL Code to fetch text field values dynamically

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am generating textfields dynamically using JSTL forEach.
Here is the code ..


If there are 4 values in underlyingTickersList A, B C, D and E ... I am getting those values correctly displayed in each text field.

However if I submit the form with all these value how can I get it in the bean? I guess I need to have dynamic id or name for each text field. How can generate it?

Note** I dont have Struts framework.. I am using request.getParameter to fetch the values and set into the bean variable.
 
Sheriff
Posts: 67265
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
id values have nothing to do with form submission at all; the name attribute is the parameter name used on submission.

Because you have four elements all with the same name, you can easily retrieve them as an array with request.getParameterValues().

Alternatively, you could give each element a dynamic name value if that makes more sense.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!