4 Replies Latest reply on Feb 6, 2002 4:25 AM by a_stannard

    JSP Servlet error

    a_stannard

      Hi on my first attempt to implement a simple example of a MVC application I get a 403 error.

      I am using JBoss-2.4.3_Jetty-3.1.3

      I use a WAR file that contains the jsp's and the servlet, and a JAR that contains an EJB. The WAR and JAR are then wrapped inside an EAR file.

      The jsp's (http://localhost:8080/servlets/EShop.jsp) display fine but when I try a submit action and an http request is supost to be passed onto the servlet I get:

      HTTP ERROR: 403 Forbidden
      RequestURI=/servlets/web-inf/classes/servlets/ShoppingServlet

      all help appreciated

      Andy

        • 1. Re: JSP Servlet error
          jules_gosnell

          Post with more detail to jetty-discuss@yahoogroups.com.

          It sounds to me like you have some security declared which is protecting the url you are trying to access.

          Tell them the url the submit posts to and the contents of yor web.xml,

          Jules

          • 2. Re: JSP Servlet error
            a_stannard

            More info:

            web.xml:

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <web-app>
            <display-name>Andy's Demo</display-name>
            <session-timeout>30</session-timeout>

            <servlet-name>ShoppingServlet</servlet-name>
            <servlet-class>servlets.ShoppingServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            <init-param>
            <param-name>name</param-name>
            <param-value>value</param-value>
            </init-param>

            </web-app>


            actual address of servlet
            C:\TempDemo\build\web\web-inf\classes\servlets\ShoppingServlet

            url address
            http://localhost:8080/servlets/web-inf/classes/servlets/ShoppingServlet



            actual address of jsp
            C:\TempDemo\build\web\EShop.jsp

            url address
            http://localhost:8080/servlets/EShop.jsp

            jsp servlet link address "web-inf/classes/servlets/ShoppingServlet"

            Andy

            • 3. Re: JSP Servlet error
              tbfmicke

              You need to have a servlet mapping to find the
              servlet via an URL, the package name is NOT used
              to find it.

              I.e.
              Add:
              <servlet-mapping>
              <servlet-name>ShoppingServlet</servlet-name>
              <url-pattern>/ShoppingServlet</url-pattern>
              </servlet-mapping>

              To the web.xml, after the declaration.
              Then change the URL in the JSP page to

              "/servlets/ShoppingServlet"

              (since it seems you use a web-app name of "servlets"
              which is a bit strange")
              or just

              ShoppingServlet

              should work too, if the jsp is in the "root" of
              the webapp.

              Regards

              • 4. Re: JSP Servlet error
                a_stannard

                Excellent, thanks for everyones help!

                Andy