0 Replies Latest reply on Mar 13, 2007 4:56 PM by Rich win

    forward and getRequestUri question

    Rich win Newbie

      I have a jsp act as a servlet like:

      <servlet-name>myJspServlet</servlet-name>
      <jsp-file>/myJspServlet.jsp</jsp-file>

      <servlet-mapping>
      <servlet-name>MainLayout</servlet-name>
      <url-pattern>*.my</url-pattern>
      </servlet-mapping>

      mean all of request with .my should be processed by the servlet witch represented by myJspServlet.jsp

      on the myJspServlet.jsp, I output the result of pageContext.getRequestUri()

      I did some exprement, but the result are diffrent.

      on JBoss 3.2.3 which based on tomcat4.1,
      if I request page /abc/a.my, I got /abc/a.my (I call it result A)
      if I request page/abc/f.jsp, witch do pageContext.forward("/abc/a.my"); I got /myJspServlet.jsp (I call it result B)

      further, if I change
      <jsp-file>/myJspServlet.jsp</jsp-file>
      to
      <servlet-class>org.apache.jsp.myJspServlet_jsp</servlet-class>

      I always get result B no matter the request was sent directly or by forward.

      on tomcat 5.0. I always get result B no matter the request was sent directly or by forward , even I use <jsp-file> in web.xml

      what's result is correct. is it just a bug in old tomcat. what does specification say(I red, but not clear to me).

      Thanks