tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Altering content of BodyContent prior to JSP eval
Date Tue, 09 Apr 2002 15:58:09 GMT


On Tue, 9 Apr 2002, Jeffrey Bonevich wrote:

> Date: Tue, 09 Apr 2002 09:57:45 -0400
> From: Jeffrey Bonevich <bonevich@telocity.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>,
>      bonevich@telocity.com
> To: "tomcat-user@jakarta.apache.org" <tomcat-user@jakarta.apache.org>
> Subject: Altering content of BodyContent prior to JSP eval
>
> How can I get at the content of BodyContent in a BodyTagSupport
> subclass, alter that content, and then reinsert the content into the
> body before it gets evaluated as JSP?  Is this just just totally
> anathema to JSP spec or something?  Say that I have the following:
>
> <mytaglib:bodymunger value="lookup">
>    Place the stuff *** here
> </mytaglib:bodymunger>
>
> Then in the BodymungerTag (extends BodyTagSupport) I want to lookup the
> value of "lookup", grab the body content, and replace the string "***"
> with that value.  Say the value actually returns a string:
> 	<mytaglib:othertag/>
>
> Then I want that new content evaluated as JSP.
>
> Is there any way to do this?  Do I have to do it manually using Jspc or
> something?
>

This isn't supported by JSP 1.1 or 1.2.  Your only choices for body
content are:
- Ignore it
- Treat it as opaque text (i.e. an SQL tag might read a
  SELECT statement directly out of the body)
- Execute it as normal JSP text.

In JSP 1.3 (the spec currently being developed), we're considering a
concept called "JSP Fragments" which essentially says "here is a chunk of
JSP code -- treat it as a reusable component" that will be useful for
scenarios like what you are describing.  Essentially, you will be able to
use JSP code to create what amounts to a custom tag.  However, that
feature is still in the future.

> jeff

Craig


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message