I think he wants to store the entire text of the JSP in a string variable as it was sent from the server to the client for display. Maybe to store as a text file or something. (Not that I know how to do that.) Maybe an explanation of why you want this would help enlighten the experts.
Greg -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Galbreath, Mark Sent: Tuesday, June 25, 2002 12:25 PM To: [EMAIL PROTECTED] Subject: Re: Getting the output of a JSP There must be a translation issue here (or I am being obtuse), because I'm still not getting it. You are saying that (1) the JSP is already being displayed in a browser, but (2) you need in in a String. Do you mean that the JSP that is NOW being displayed you do not need/want to be displayed and INSTEAD want the JSP to be captured in a String so that String someMethod() will return this String? I don't understand your "String XXX = someProcess(Example.jsp?name=i)" example. If you have example.jsp and a Name variable already, why do you want to pass it to someProcess()? Do you want XXX to represent an entire JSP with dynamic fields? Is the end result something like: StringBuffer sb = new StringBuffer("<%@"); sb.append( page contentType=\"text/html;charset=WINDOWS-1252\"") sb.append( "sErrorPage=\"false\""); sb.append( "errorPage=\"/error.jsp\""); sb.append( "session=\"true\""); sb.append( "taglib uri=\"struts-logic.tld\" prefix=\"logic\""); sb.append( "taglib uri=\"struts-bean.tld\" prefix=\"bean\""); sb.append( "taglib uri=\"struts-html.tld\" prefix=\"html\""); sb.append( "taglib uri=\"partner.tld\" prefix=\"partner\" %>"); sb.append( "<html>"); sb.append( "<head></head>"); sb.append( "<body>"); sb.append( "Hello, <%= request.getAttribute( \"name\") %>"); sb.append( "</body>"); sb.append( "</html>"); String XXX = sb.toString(); ? Mark -----Original Message----- From: Iv�n Escobedo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 12:11 PM The output is a jsp already displayed on a browser, but i need it not in a browser but contained in a String variable. >From: "Galbreath, Mark" <[EMAIL PROTECTED]> >Date: Mon, 24 Jun 2002 20:33:56 -0400 > >What output? Your question doesn't make any sense. You already have the >name being displayed as you say you want it. If you just want to keep the >format for use somewhere else, put Name in session scope: > >String XXX = "<html><body>" + session.getAttribute( "Name") + >"</body></html>"; > >Mark > >-----Original Message----- >From: Iv�n Escobedo [mailto:[EMAIL PROTECTED]] >Sent: Monday, June 24, 2002 7:17 PM > >How can i set a String variable with the output of a JSP already loaded or >processed. > >Here's the jsp page: > >Example.JSP > ><html> ><body> >Hello <%= request.getAttribute("Name") %> ></body> ></html> > >So, i need this process to load and retrieve the JSP output: > >String XXX = SomeProcess(Example.jsp?Name=ij) > >So, finally XXX will contains: > >XXX = "<html><body>Hello ij</body></html>" ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
