• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concatenating textfield names with ${status.index}

 
Arathi Shekhar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table whose columns will be created dynamically depending on the
objects.
For example if we have customer then each column will have that object with
Name,Address,Phone etc as rows
I have named the textfields as name1,name2 etc for name dynamically by taking the ${status.index} value.And similarly fro the other fields.After
entering the details when I click on save it should perform validation in the server side and if any errors are present then it should display the value in the respective textfield with an error message.
I want to use if test = "${not empty param.name1}".
But is there any way of getting name1 or can I get name[0].

Thanks in advance,
Arathi
 
Stefan Evans
Bartender
Posts: 1692
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Validation should be done in java code rather than in JSTL.
JSTL is not suited for it.

The following code does demonstrate how to use dynamic names to access collections though. If you put all your errors into a map keyed by fieldName, the following would work:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic