aspose file tools*
The moose likes JSP and the fly likes How can I get the unevaluated body content of the tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How can I get the unevaluated body content of the tag" Watch "How can I get the unevaluated body content of the tag" New topic
Author

How can I get the unevaluated body content of the tag

Gnanasekaran Sakthivel
Greenhorn

Joined: Jul 14, 2004
Posts: 23
I would like to change the unevaluated body content of the tag and alter it and let it evaluate.
<lib:tag1>
<lib:tag2 attribute1="something" attribute2="something" etc />
</lib:tag1>

I have it this way and it does not work.
Tag1 extends BodyTagSupport, if I try to get the body content in the doInitBody, it is empty. If I get it in doAfterBody, it is already evaluated.

I really would like to take the content (I mean the <lib:tag2 .../>) and add/remove few more attributes conditionally and let it evaluate.

Can you help me?


Best Wishes
Gnanasekaran Sakthivel
Greenhorn

Joined: Jul 14, 2004
Posts: 23
I think it is not possible as I read in the documentation. Nested tag's contents will be processed before handing over to the enclosing tag.
I am going to try to modify the processed content conditionally.
Please let me know if I need to understand anything.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1029
As you have noticed, it is not really possible to add/remove attributes to the tag.
But it is perfectly valid to modify the values of attributes which get passed to the tag.

So have your outer tag export/define the variables, and the inner tag depend on them.
It ties them together a little, but if they are logically related anyway that is not necessarily a problem.

If you need to add/remove attributes I think the only way to do it would be to conditionally choose which tag to invoke.
ie



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I get the unevaluated body content of the tag