• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Obtaining the body content of a tag as text

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to get the body of a custom tag as a String, make some changes in it, and then puting it back in the body. Also, I don't want the body of the tag to be executed, but just outputed as string.

Example :

-------------------------------------
<c:set var="test" value="abc" />

<tag:custom>
<c ut value="${test}" />
</tag:custom>
-------------------------------------

So in my custom tag, I'll replace the string "${test}" by "abc". So the result that I want to see in my browser is :
<c ut value="abc" />

I'm able to get the body content as a String with doAfterBody(), but it's already executed and, in the example, is alreay equals to "abc", and not "<c ut value="${test}" />"

Any idea?
[ May 07, 2006: Message edited by: Marc Larochelle ]
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Declare the <body-content> of the tag as "tagdependent" in the TLD... this prevents the container from parsing the contents but instead passes them literally.

That should do the trick.
 
Marc Larochelle
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's working, thank you !
 
reply
    Bookmark Topic Watch Topic
  • New Topic