Two Laptop Bag*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using <c:set> with var attribute to set multiple Strings values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Using <c:set> with var attribute to set multiple Strings values." Watch "Using <c:set> with var attribute to set multiple Strings values." New topic
Author

Using <c:set> with var attribute to set multiple Strings values.

Cyril Sadasivan
Greenhorn

Joined: Jul 17, 2012
Posts: 22
What happens when <c:set> is used as below ?

-What kind of object is stored in the attribute "userLevel"?
-How do we access members of "userLevel" individually?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Hi Cyril,

-What kind of object is stored in the attribute "userLevel"?

In one String as an attribute of the HttpSession object -> HttpSession.setAttribute(userLevel, " Sheriff, Bartender, Cowgirl ")

-How do we access members of "userLevel" individually?

You can't as it is one String only

Regards,
Frits
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

You might want to investigate the JSTL string functions.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jalil idrissi
Greenhorn

Joined: Feb 05, 2013
Posts: 6
You can loop over a comma-delimited string, using c:forEach as in:



OCEJWCD 6
OCPJP 7
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using <c:set> with var attribute to set multiple Strings values.