Forums Register Login

Obtaining the body content of a tag as text

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
It's working, thank you !
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 767 times.
Similar Threads
mock 5 - 78% score - experiences
HFSJ Mock question On page 487
JSP fails to read POST parameters
doubt in JSTL c:out
Passing a bean property to a custom tag using JSTL
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:58:02.