File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes target attribute of c:set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "target attribute of c:set" Watch "target attribute of c:set" New topic
Author

target attribute of c:set

Ming Li
Greenhorn

Joined: Jan 28, 2004
Posts: 12
hi,
The following quoted text is come from JSTL1.1 spec page 40

Syntax 1: Set the value of a scoped variable using attribute value
<c:set value=�value� var=�varName� scope=�{page|request|session|application}�]/>
Syntax 2: Set the value of a scoped variable using body content
<c:set var=�varName� [scope=�{page|request|session|application}�]>
body content
</c:set>
Syntax 3: Set a property of a target object using attribute value
<c:set value=�value� target=�target� property=�propertyName�/>
Syntax 4: Set a property of a target object using body content
<c:set target=�target� property=�propertyName�>
body content
</c:set>

I understand syntax 1 and 2, the var attribute is a name of a scoped variable, but I am not sure what is the target attribute in syntax 3 and 4, I tested some codes and found that the target object must be a scoped object(JavaBean or Map type), is that right ?
Moorthi Ramasamy
Greenhorn

Joined: Jan 02, 2004
Posts: 15
Originally posted by Ming Li:
hi,
The following quoted text is come from JSTL1.1 spec page 40
I understand syntax 1 and 2, the var attribute is a name of a scoped variable, but I am not sure what is the target attribute in syntax 3 and 4, I tested some codes and found that the target object must be a scoped object(JavaBean or Map type), is that right ?

Syntax 3: Set a property of a target object using attribute value
<c:set value=�value� target=�target� property=�propertyName�/>
Sets the value (using value attribute) of the javaBean/Map object (exception will be thrown if the target is not javaBean or Map) property.
If the value attribute is null, the specific property will be removed from Map object & set to null for javabeans.
Syntax 4: Set a property of a target object using body content
<c:set target=�target� property=�propertyName�>
body content
</c:set>
This is similar to syntax 3 except that value for the property will be taken from body content.
Thanks,
Moorthi
[ January 31, 2004: Message edited by: Moorthi Ramasamy ]
Ming Li
Greenhorn

Joined: Jan 28, 2004
Posts: 12
hi Moorthi,
Thanks for your reply, but my doubt is that I am not sure if the JavaBeans/Maps you mentioned must be scoped variables, I tested some code and I think they must be scoped varibles, the spec does not mention this directly, so, I am not sure!
anybody clear my mine?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: target attribute of c:set
 
Similar Threads
Confusion about "scope" attribute
HFSJ 2ed - about <c:set>
Regarding JSTL1.1-JSP 2.0-TLD
To Which Scope c:set target.... tag values will be bounded
Headfirst Servlets and Jsp <c:set> pg.457