Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I set this variable in JSTL?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have three page attributes (hotels, motels, rvParks) that are all lists of the same object. Based on a JSTL loop variable, I want to set a generic attribute to represent one of these three. However, this code



turns the variable accommodations into something of type string instead of the java.util.List of objects that I want. How do I adjust the above so that the variable "accommodations" gets set to the same type as the attribute I'm referring to?

Thanks, - Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the code is saying: "take the rendered body of the <c:set> tag and make it the value of the variable."

Rendered body will always be text.

Why aren't you handling this in the controller instead of doing hand-stands in the JSP?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how to rewrite the c:set clause to set the attribute correctly instead of the string that is getting rendered? -
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic