• 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

Custom Tags: Capturing body content before it is evaluated

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTML-encode the content:



P.S. Please click the 'disable smilies' checkbox when posting code.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic