Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c:set target doubt

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If we tell
<c:set var="test1" value="testing">

If an object named test1 does not exist at session scope, it is automatically created provided value is not null. What kind of
objects can only be created in this way. Can I create a HashMap
object in this way?

I know target and var can't be used together. So how can Map object be
created and assigned key and value if I don't use <jsp:useBean ...> tag
and only use <c:set>.


Thanks,
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
c:set var is meant for Attributes only. c:set target is for bean properties and Map values only. c:set target is used for REAL OBJECTS, an actual object in existence.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sunder!


If bean is automatically created in case of <c:set var> if it does not
already exist and value is not null. Doesn't this rule apply with Map?


Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic