-----Original Message-----
From: Lukas Bradley [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 15, 2000 10:47 AM
To: [EMAIL PROTECTED]
Subject: How can I mimic jsp:forward functionality?


With the advent of JSP, I would like to mimic the jsp:forward
functionality within my servlets.  How can I do this?

Example:
<%-- begin forward.jsp --%>
<%@ page language="java"%>
<html>
<BODY>
<% System.out.println("Before jsp:forward call.") ;%>
This is my forward.jsp page.
<jsp:forward page="test.jsp"/>
<% System.out.println("After jsp:forward call.") ;%>
</BODY>
</HTML>
<%-- End forward.jsp --%>


<%-- Begin test.jsp --%>
<%@ page language="java"%>
<html>
<BODY>
This is test.jsp page.
</BODY>
</HTML>
<%-- End test.jsp --%>


Example's HTML Output:
<html>
<BODY>
This is test.jsp page.
</BODY>
</HTML>

Example's stdout output:
Before jsp:forward call.


I have attempted (to no avail) with the following source code.  The
following code still returns control back to the original JSP/Servlet and
continues processing.

// The output buffer needs to be reset, figure this out!!!!!!
//pControl.mResponse.resetOutputBuffer() ;  ?!?!?
Servlet lServlet = (Servlet) pControl.mServletReference ;
ServletContext lServletContext =
lServlet.getServletConfig().getServletContext() ;
RequestDispatcher lRequestDis = lServletContext.getRequestDispatcher(pURL);
if ( lRequestDis == null ) throw new ServletException("unknown
forwarding page: `" + pURL + "'");
lRequestDis.forward(pControl.mRequest, pControl.mResponse);


Thank you for any and all help.

Lukas

___________________________________________________________________________
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

Reply via email to