tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: JSP vs. Servlet Paths
Date Tue, 13 Aug 2002 13:26:06 GMT
This is because your web browser which needs to send request to the server 
has no idea about your application context whereas 
getServletContext().getRequestDispatcher().forward() will only forward 
stuff within your own context so prepending the context would be redundant 
here.

Jake

At 11:00 PM 8/12/2002 -0700, you wrote:
>Hi all,
>
>I'm new to this list and really need some help.  Let me frame the scenario:
>
>I have CATALINA_HOME set to C:\jakarta-tomcat-4.0.4\jakarta-tomcat-4.0.4.
>The rest of the directory structure (and file locations) is as follows:
>
>CATALINA_HOME
>       |
>       +-- webapps
>              |
>              +-- demo
>                    |
>                    +-- jsp
>                    |
>                    +-- WEB-INF
>                           |
>                           +-- classes
>
>The "classes" directory contains MyServlet.class, WEB-INF contains web.xml,
>"jsp" contains both SourceJsp.jsp and TargetJsp.jsp.
>
>SourceJsp.jsp displays a submit button, which then calls TargetJsp.jsp,
>i.e., it contains the line "<FORM METHOD="POST"
>ACTION="/demo/jsp/TargetJsp.jsp">".  I then have a Servlet, MyServlet.java
>that also calls TargetJsp.jsp.  MyServlet.java contains the line
>"this.getServletContext().getRequestDispatcher("/jsp/TargetJsp.jsp").forward
>(req, resp)".
>
>Please pay attention to the path difference between these two calls.
>SourceJsp.jsp and MyServlet.java both "invoke" the same TargetJsp.jsp,
>however, the paths are different: SourceJsp.jsp = /demo/jsp/TargetJsp.jsp;
>MyServlet.java = /jsp/TargetJsp.jsp.
>
>I need to understand why this must be the case.  What is the difference
>between a JSP invoking a JSP and a Servlet invoking a JSP with regard to the
>paths required for such invocation?
>
>Thank you for your help!  I appreciate it!
>
>Regards,
>
>Adam
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message