File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Concatenating textfield names with ${status.index} Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Concatenating textfield names with ${status.index}" Watch "Concatenating textfield names with ${status.index}" New topic

Concatenating textfield names with ${status.index}

Arathi Shekhar

Joined: Oct 04, 2005
Posts: 3
I have a table whose columns will be created dynamically depending on the
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,
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
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:

I agree. Here's the link:
subject: Concatenating textfield names with ${status.index}
It's not a secret anymore!