Sun as good examples that comes with jswdk-1.0.1 and orion has those
examples too.  This are the code snippet from Sun's examples:

Source Code for Servlet calling JSP
import javax.servlet.*;
import javax.servlet.http.*;

public class servletToJsp extends HttpServlet {

    public void doGet (HttpServletRequest request,
                       HttpServletResponse response) {

        try {
            // Set the attribute and Forward to hello.jsp
            request.setAttribute ("servletName", "servletToJsp");

getServletConfig().getServletContext().getRequestDispatcher("/examples/jsp/j
sptoserv/hello.jsp").forward(request, response);
        } catch (Exception ex) {
            ex.printStackTrace ();
        }
    }
}


Source Code for JSP calling servlet
<!-- Forward to a servlet -->
<jsp:forward page="/servlet/servletToJsp" />


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 18, 2000 7:50 AM
To: [EMAIL PROTECTED]
Subject: regs servlet calling Jsp...


Hi all,
  Can anyone help me how to call a JSP from a servlet.

1.)  I've tried with "callPage" but I'm getting  ClassCastException at
this step:

        ((com.sun.server.http.HttpServiceResponse)
res).callPage("/DisplayData.jsp", req);


2.) I can call a JSP page with sendRedirect but I can't send the
information from servlet to this page.
        Is it possible to send info from servlet thru sendRedirect. If so,pl
let me know.

Help me out.

Thanks in advance,
Chary

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to