You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rami Ojares <ra...@legosoft.net> on 2003/01/09 11:06:16 UTC

Evaluating jsp inside java

Hi

I am building tag <reevaluate> which takes it's
bodycontent and evaluates it as jsp.

Ex.
<reevaluate>
    <getSomeDataThatHappensToBeArbitratyJSPWithTagsAndAll />
</reevaluate>

So in doEndTag() I get the body content and would like to have a method
like this

String Jasper.evaluate(String arbitraryJsp, ServletContext sameContext)

Because I could not decipher Jasper's logic well enough I tried also
writing body content to temporary file and then including that jsp file
with RequestDispatcher. But that also gives me error that getOutputStream has already been
called.

I even tried to implement my own HttpServletResponse that just stores in StringBuffer
everything that is written to it but that gives some obscure errors too.

Any ideas/knowledge?

- rami

Re: Evaluating jsp inside java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 9 Jan 2003, Rami Ojares wrote:

> Date: Thu, 9 Jan 2003 12:06:16 +0200
> From: Rami Ojares <ra...@legosoft.net>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Evaluating jsp inside java
>
> Hi
>
> I am building tag <reevaluate> which takes it's
> bodycontent and evaluates it as jsp.
>
> Ex.
> <reevaluate>
>     <getSomeDataThatHappensToBeArbitratyJSPWithTagsAndAll />
> </reevaluate>
>
> So in doEndTag() I get the body content and would like to have a method
> like this
>
> String Jasper.evaluate(String arbitraryJsp, ServletContext sameContext)
>
> Because I could not decipher Jasper's logic well enough I tried also
> writing body content to temporary file and then including that jsp file
> with RequestDispatcher. But that also gives me error that getOutputStream has already been
> called.
>
> I even tried to implement my own HttpServletResponse that just stores in StringBuffer
> everything that is written to it but that gives some obscure errors too.
>
> Any ideas/knowledge?
>

Just a suggestion ... give up on this approach.

If you're going to all the effort to generate something, you might as well
just generate the final HTML directly.  Trying to generate JSP code on the
fly, then compile and execute it, is just going to eat performance for no
good reason.

> - rami

Craig




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>