This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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?
 
GeeCON Prague 2014
 
subject: target attribute of c:set