Rhett Savage <[EMAIL PROTECTED]> wrote:
> if i understand correctly then one way you could
> accomplish that is simply by reading the output of the
> JSP (which you serve in the usual way) into a string
> using the java.net.URL class, something similar to the
> code below - this way any includes, interpolations,
> calculations that occur in the JSP will already have
> happened by the time it becomes an ordinary string...
No, i dont want to ask the webserver my parsed jsp, but in the webserver itselve
retrieve it.
An example of what i try to accomplish is attached below...
>
> rhett
>
> <sourcecode>
> ---
>
> On Tue, 3 Apr 2001, Eduard Witteveen wrote:
>
> > Hello,
> >
> > I want to do some operations, after that the JSP page has been parsed.
> > For this i need the get the output of the jsp page, which has been parsed, i want
>to use this output as input for something else. How can i archief this?
> > * Is there a way to put more then one servlet after eachother? or
> > * How can i get the output of the jsp parser, before it is send to the browser,
>and change this.
> >
public synchronized void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException {
JspFactory factory = JspFactory.getDefaultFactory();
if(factory==null) {
log.error("im getting this error all the time.....");
}
StringResponse tempResponse = new StringResponse();
PageContext pageContext = factory.getPageContext( this, //the requesting
servlet
req, //the current
request pending on the servlet
tempResponse, //the
current response pending on the servlet
null, //the URL of the
error page for the requesting JSP, or null
false, //true if the JSP
participates in a session
1024, //size of buffer
in bytes, PageContext.NO_BUFFER if no buffer, PageContext.DEFAULT_BUFFER if
implementation default.
true //should the
buffer autoflush to the output stream on buffer overflow, or throw an IOException?
);
pageContext.include(req.getRequestURI());
String parsedJsp = tempResponse.getString();
// now i can use the parsedJsp for generation of
// somekinda file... let's say a pdf from a tex doc in which i
// i used jsp....
}
--
Eduard Witteveen Systeemontwikkelaar NOS Internet
Mediacentrum Kamer 203, tel. +31(0)35 6773059
Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal