you cannot perform a dynamic forward to a static resource such as HTML file.
try:
* using a static include, if JSP ( <%@include file="myfile.html"%> )
* performing a redirect ( response.sendRedirect("myfile.html") );
btw I am not sure whether a relative url redirection will actually work. if
not, try specifying the entire url starting from the http.
zm.


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Sriram N
Sent: Wednesday, February 20, 2002 3:11 PM
To: [EMAIL PROTECTED]
Subject: RequestDispatcher.forward() works for jsps but not html files


Hello,

I am using Tomcat 4.0.1
I have an html file in the root directory of my application, and am
unsuccessful in trying to forward the request to this html file form within
another jsp.
E.g.
The following code snippet gives me an IllegalStateException
--- code snippet ---
String forwardToURL = "/trial.html";
ServletContext sc = getServletContext();
sc.getRequestDispatcher(forwardToURL).forward(request,response);
---

where as the following works just fine.
--- code snippet ---
String forwardToURL = "/trial.jsp";
ServletContext sc = getServletContext();
sc.getRequestDispatcher(forwardToURL).forward(request,response);
---

Both trial.html and trial.jsp are in the root folder of my web application.

Could someone offer some pointers on where I am going wrong ?

Thanks,

Sriram

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.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

Reply via email to