• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Tags: Capturing body content before it is evaluated

 
Jeremy Linzer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like ot create a custom tag that captures its bode content before it is evaluated. The nthe tag handler manipulates it in some way and prints out the result. Also, the body content should eventually be evaluated.

For example:
<a isplayCode>
<b:someCustomTag attr1="someValue" />
</a isplayCode>

I would liek to capture the unevaluated custom tag,<b:someCustomTag attr1="someValue" />, and print it to the web page, replacing special characters with their ascii equivalent, and also do whatever functionality the inner custom tag is supposed to do.

I tried overriding the doInitBody() method thinking that the bode content has been set but just not evaluated but the body content comes up empty. I tried
BodyContent body = getBodyContent();
String orig = body.getString();

Any ideas or thoughts would be appreciated.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Sorry, but this is not possible. The body content is evaluated.
 
Jeremy Linzer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thansk for your response.

I would like to change my question slightly since I can't do what I originally wanted to.

Is it possible to display an unevaluated custom tag to the browser even when the tag is coded normally, without special charcters?

For example in the JSP you would have the following,
<a isplayCode>
<b:someTag attr="someValue" />
</a isplayCode>

In the browser "<b:someTag attr="someValue" />" would be displayed.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML-encode the content:



P.S. Please click the 'disable smilies' checkbox when posting code.
 
Dan Novik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
describe your tag as tagdependent and you can capture body "as is".
After that you can do whathever you need and evaluate your body string
with the another tag
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!