File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 1707

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: 1707
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