Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubts regarding access and manipulation of body in Simple tags and in classic custo

 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am very confuse about access and manipulation of body in Simple tags and in classic custom tags.
I have read from manning that we can access but not manipulate body in simple tag but we can do this in classic tags.Is it true?Please anybody put more light on this.
 
Antonio Tercero
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to manipulate body content from a classic custom tag,
you must declare a tag handler that extends BodyTagSupport instead of TagSupport.
You can access body content by calling the getBodyContent() method.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it, body manipulation is provided through the BodyTag interface. Since SimpleTagSupport does not implement this interface, the desired functionality is not available when implementing simple tags. The desired functionality is also not available in classic tags whose actions extend TagSupport. The desired functionality is available in classic tags when extending BodyTagSupport (which implements BodyTag).
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mr.Dee Brown and all.
It means that through simple tags we can only access body content but can not manipulate.Is it true?

[ June 16, 2008: Message edited by: pradeep singh ]
[ June 16, 2008: Message edited by: pradeep singh ]
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any update?
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any update please?
 
John Pearson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can manipulate body content of a SimpleTag. To get at the body contents, you have to use the invoke() method to write it to a Writer, and then use the appropriate methods of that Writer to get the contents.

Since I always find it easier to understand code rather than explanations like I've just given, here's a short example for a SimpleTag that will take the tag's body as a String, convert it to uppercase, and print it out.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic