tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rhett Savage <rh...@nonlocal.com>
Subject Re: How to get the parsed JSP string
Date Wed, 04 Apr 2001 07:36:46 GMT
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...

rhett


 public String url2String(String url_of_a_jsp) {

	String text = "";
	String line;

	try {
		URL u = new URL(url_of_a_jsp);

		InputStream in = u.openStream();
		in = new BufferedInputStream(in);
		BufferedReader br = new BufferedReader( new InputStreamReader(in) );
		while ((line = br.readLine()) != null) {
			text += line + "\n";
		}
	}
	catch (Exception e) {
		System.out.println(e);
	}

	return text;
 }

---

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.
>
> greetings,
>
> --
> Eduard Witteveen	Systeemontwikkelaar NOS Internet
> Mediacentrum Kamer 203, tel. +31(0)35 6773059
>
> Sed quis custodiet ipsos custodes? : The sixth Satire from Juvenal
>



Mime
View raw message