Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Cyril Sadasivan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Pie
Posts: 2415
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to investigate the JSTL string functions.
 
jalil idrissi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can loop over a comma-delimited string, using c:forEach as in:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic