Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL Code to fetch text field values dynamically

 
SachinJ Joshi
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64698
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic