File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

target attribute of c:set

 
Ming Li
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic