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