File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Concatenating textfield names with ${status.index}" Watch "Concatenating textfield names with ${status.index}" New topic
Author

Concatenating textfield names with ${status.index}

Arathi Shekhar
Greenhorn

Joined: Oct 04, 2005
Posts: 3
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

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

 
wood burning stoves
 
subject: Concatenating textfield names with ${status.index}