• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it working by using below tag

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic