jdeveloper wrote:
>
> Hi, Hans Bergsten,
>
> try to rename A.html to A.jsp.

I think you got the authors mixed up. I (Hans Bergsten) answered a question
from Henry Hooi Tak Keong about why he gets a 404 when using a RequestDispatcher
to include an HTML page.

Your suggestion to use a jsp extension instead of an html extension doesn't
work.
A 404 means "not found" and if the file is using an html extension, changing it
to jsp will not make a difference. The problem is more likely due to how the
relative URIs are interpreted, as I described in my original answer (still
included below).

Hans

> >Hans Bergsten wrote:
> >Henry Hooi Tak Keong wrote:
> >>
> >> Hi all,
> >>
> >> I went through the JSP resource list but couldn't find anything that related
> >> directly to this topic. What I have is  a servlet that basically stores some
> >> values in a session object and then forwards the control to the JSP page
> >> that displays the values of the session on screen, through the forward
> >> method of the request dispatcher object.
> >>
> >> RequestDispatcher dispatcher =
> >> getServletContext().getRequestDispatcher("/fxdetails/A.html");
> >> dispatcher.forward(request, response);
> >>
> >>  Lets say that A is the html file that I am forwarding the control to and in
> >> this html file I define the <frameset> tags to that call B.jsp and C.jsp, as
> >> shown below. All files A.html, B.jsp and C.jsp are in the same directory.
> >>
> >> <FRAMESET rows="100,*" frameborder="NO" border="0" framespacing="0">
> >>  <FRAME name="headerFrame" src="./B.jsp" scrolling="NO" noresize>
> >>  <FRAME name="contentFrame" src="./C.jsp">
> >> </FRAMESET>
> >>
> >> The browser screens however returns to me a "HTTP 404: file not found error"
> >> for each the frame slots where the file B.jsp and C.jsp should be loaded. Is
> >> there something wrong with my code. Please help.
> >
> >What URI do you use to invoke the servlet? When you use relative URIs in a page
> >that you forward to, like you do for the two JSP pages in A.html, the browser
> >interprets them as relative to the URI used to make the original request.
> >So if you invoke the servlet with a URI like /servlet/foo, the browser will
> >try to get the JSP pages with URIs /servlet/B.jsp and /servlet/C.jsp.
> >
> >The solution I prefer is to define an URI mapping for the servlet so it
> >can be invoked with a URI that matches the path to the JSP pages. For instance,
> >if the URI for B.jsp is really /someDir/B.jsp, I define a mapping for the
> >servlet like /someDir/foo. The browser is then able to construct the correct
> >absolute URI from relative URIs.
> >
> >For details about how to define URI mappings for a servlet, see your servlet
> >container documentation or the Servlet 2.2 specification (the Web Application
> >Deployment Descriptor section):
> >
> >  <http://java.sun.com/products/servlet/>
> >
> >Hans

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to