Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Spring and the fly likes Not able to specify path for form:select tag with list of objects... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Not able to specify path for form:select tag with list of objects... " Watch "Not able to specify path for form:select tag with list of objects... " New topic
Author

Not able to specify path for form:select tag with list of objects...

Anoop Nair
Ranch Hand

Joined: Oct 29, 2008
Posts: 70
I have a doubt when using Spring.

I have a model class (A) which has a list of objects of another class (B).
In my JSP, I have to iterate over this list of objects.
I am trying to set the path attribute of a select box during the iteration. The path is a member of class B.
For each iteration, I have to refer to the member of the corresponding object only. I am not able to figure out how to specify this in JSP.

Below is a snippet of the model class and also the JSP. Also I have mentioned two things which I tried.


Model class:



JSP:





Below are the two approaches I tried:
1. Set the path as just a string as in above example.
In this case, Spring looks for a member with the name of the iteration variable (specialGroups in my case) in the model class. And since its not able to find one, it throws error.

2. Set the path by ${specialGroups.specialGroupId}
In this case, the value in the EL got evaluated. Spring then looks for a member having the name as the EL value. Again, in this case it throws error as there is no field with that name.
Anoop Nair
Ranch Hand

Joined: Oct 29, 2008
Posts: 70
I got it working by using below tag

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to specify path for form:select tag with list of objects...