This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes c:set target doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "c:set target doubt" Watch "c:set target doubt" New topic

c:set target doubt

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710

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>.


Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
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

Joined: Feb 28, 2007
Posts: 1710
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?

I agree. Here's the link:
subject: c:set target doubt
It's not a secret anymore!