0

I would like to be able to extract the content already written to the JSPWriter in a custom tag (using the new SimpleTagSupport). Then I want to manipulate that content and then write it back out to the JSPWriter.

In my company we are creating a set of custom tags that will encapsulate all html for a page - so we can be assured of correct html output. The tags do a lot more - provide consistent look and feel, proper markup for accessibility under different situations - normal processing and error considerations etc.. We also want the JSP developers to have as little as needed to code on the page. So, common things on every page are incorporated in the custom tag that encapsulates the whole page (called a page tag). So for example, the page banner is in this outermost custom tag. One of the things the page tag outputs is the html title tag. The content, for accessibility reasons, is dynamic and dependent on the processing of the page first. I would like to be able to process the whole page - after which we know the dynamic content needed for the html title attribute - and then create and insert the title tag. However, by this time all of the content has been written the JSPWriter. So, I want to get the content of the writer add in the html title tag and then write it back out.

Is this clearer? Should I explain more?

Can this be done and if so how?

Thanks so much in advance for any help. Jeremy

4

1 回答 1

1

您可能希望您的page标签扩展BodyTagSupport ,然后通过getBodyContent方法检索由子元素写入的数据。JEE5 教程中有一个示例。

于 2010-01-01T18:03:39.823 回答