aspose file tools*
The moose likes JSP and the fly likes How do I set this variable in JSTL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How do I set this variable in JSTL?" Watch "How do I set this variable in JSTL?" New topic
Author

How do I set this variable in JSTL?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: Jan 10, 2002
Posts: 60062
    
  65

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Do you know how to rewrite the c:set clause to set the attribute correctly instead of the string that is getting rendered? -
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I set this variable in JSTL?
 
Similar Threads
unwanted integer division
Conversion to JSTL - Help
JSTL 1.0 - Get value of from an object when fn cannot be used
Color Table Rows Based on a Field Value
JSTL 1.1 - Get value from method of an Obj and set it to a variable