Colin Wilson-Salt wrote:

> What methods should I call, on what objects, with what parameters, if
> I've put some data into my session in a servlet, and want to forward to
> a jsp to display the data? I can't for the life of me find it. The faq
> only shows how to do this with from a jsp to a jsp, not from an ordinary
> servlet to a jsp. I'm fairly sure I've seen callPage(), but maybe that's
> WebSphere only.
>

The callPage() method came from the 0.91 JSP spec, and was implemented in a
non-standard way by most of the JSP implementations that did this version.

In JSP 1.0, the way to go from servlet to JSP (or back) is using
RequestDispatcher.  For example, you can put the following logic in your
servlet:

    RequestDispatcher rd =
        getServletContext().getRequestDispatcher("/my_output_page.jsp");
    rd.forward(request, response);

to forward control.  This is what <jsp:forward> uses internally.  LIkewise,
you could include the output from a JSP page in your servlet, instead of
forwarding, by changing rd.forward() to rd.include() in the example above --
which is what <jsp:include> uses internally.

Craig McClanahan

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to