I guess I'm showing my ignorance here, but what is really the advantage of
using forward as opposed to include? I'm under the impression that an
include will let me manage cookies from the servlet and still use a JSP
for the presentation.
/Robert
"Garg, Anshu (CAP, RAIL)" <[EMAIL PROTECTED]>
Sent by: "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
2000-08-21 23:26
Please respond to "A mailing list for discussion about Sun Microsystem's
Java Servlet API Technology."
To: [EMAIL PROTECTED]
cc:
Subject: Re: RequestDispatcher Again.
Hi Sandeep,
You are right. Whenever you forward a request from a servlet to a
static HTML page (by overriding doPost method), it gives the error
"Method not supported". But this is not true for a JSP. Change the
extension
of your static HTML page from .html to .jsp. Forward the request to
the jsp file again by overriding doPost method, it will work fine.
Anshu
-----Original Message-----
From: Sandeep Tikoo [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 21, 2000 4:13 PM
To: [EMAIL PROTECTED]
Subject: RequestDispatcher Again.
Hi all,
In my servlet I have to forward my request to a static
html page (URL being say,
http://localhost:8080/error.html), which I do with a
requestDispatcher.forward(). I have noticed that when
my servlet overides the doGet method, rather than
doPost,and is subsquently called with a doGet request
it works fine. However if the servlet overides the
doPost rather than the doGet method and is invoked
from a for with Method=post attribute I get the HTTP
405 error something like this:
*************************************************
Error 405
An error has occured while processing
request:http://localhost:8080/error.html
Message:HTTP method POST is not supported by this URL
*************************************************
at the point where the servlet tries to forward the
request to the HTML page.
Why does this happen, even though the servlet API for
the RequestDispatcher.forward() clearly says in its
first line:
"Forwards a request from a servlet to another resource
(servlet, JSP file, or HTML file) on the server."
I have been through the archives and have noticed that
other people have also faced similar problems.
Is this a bug or am I missing something here?
Another question regarding
requestDispatcher.forward().
The API says:
"The request and response parameters must be the same
objects as were passed to the calling servlet's
service method"
If that is the case, then wouldnt it have been better
if the signature of the forward method was
public void forward()
with the request and the response objects being passed
implicitly by the servlet engine to the invoked
resource, rather than it being as it is rightnow:
public void forward(ServletRequest request,
ServletResponse response)
Am I again missing something?
-thanks
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
___________________________________________________________________________
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
___________________________________________________________________________
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