From tomcat-user-return-29338-qmlist-jakarta-archive-tomcat-user=jakarta.apache.org@jakarta.apache.org Tue Aug 13 08:45:02 2002 Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 85344 invoked from network); 13 Aug 2002 08:45:02 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Aug 2002 08:45:02 -0000 Received: (qmail 11404 invoked by uid 97); 13 Aug 2002 08:45:20 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 11388 invoked by uid 97); 13 Aug 2002 08:45:19 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 11376 invoked by uid 98); 13 Aug 2002 08:45:18 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <70DD0724686ED611ACC70050228A1ECA06DBD4@SRV_1> From: Andreas Mohrig To: 'Tomcat Users List' Subject: AW: JSP vs. Servlet Paths Date: Tue, 13 Aug 2002 10:47:46 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N It's quite simple, really, although it has nothing to do with a = difference between JSP's and servlets (since JSP's are compiled into servlets). = The JSP's and servlets both "live" inside a context, here the "demo"-web-application. Paths within scripting-elements in JSP's or servlet-methods are (as a rule) interpreted relative to this contxt, so = "/" becomes "/demo/".=20 But when you use a form in a JSP, the following request (after the user = hits the submit-button) in fact comes from the client's browser (!), not = from within your application. Therefore, the path is interpreted relative to = the root-path of your Webserver (i.e. Tomcat or maybe Apache). greetings Andreas Mohrig cadooz AG Osterbekstr. 90b 22083 Hamburg Email: andreas.mohrig@cadooz.de Tel.: +49.40.271 482-13=20 Fax.: +49.40.271 482-11 Web: www.cadooz.de -----Urspr=FCngliche Nachricht----- Von: Adam W. Montville [mailto:adam_montville@attbi.com] Gesendet: Dienstag, 13. August 2002 08:01 An: tomcat-user@jakarta.apache.org Betreff: JSP vs. Servlet Paths 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 "
". I then have a Servlet, = MyServlet.java that also calls TargetJsp.jsp. MyServlet.java contains the line "this.getServletContext().getRequestDispatcher("/jsp/TargetJsp.jsp").for= ward (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 =3D = /demo/jsp/TargetJsp.jsp; MyServlet.java =3D /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: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: