2 Replies Latest reply on Sep 28, 2003 10:08 PM by jleaf

    Using HTML file to call Servlet

    jleaf

      Hi,

      I'm new to J2EE and learning how to build servlets at the moment.

      In the attached test application, index2.html is supposed to call ResponseDemoServlet.class when the submit button is pressed, but instead the class is immediately called whenever I try to get to the page:

      http://localhost:8080/myApp/index2.html

      Did I miss something out or did something wrongly? Any advice would be appreciated :)

        • 1. Re: Using HTML file to call Servlet
          jonlee

          Your URL pattern match in web.xml is incorrect. It should be something like /servlet/ResponseDemo, judging from your index2.html action. At the moment, you are matching when the context/ appears in your URL and redirects to the servlet rather than allowing the static content to be sent.

          • 2. Re: Using HTML file to call Servlet
            jleaf

            Hi,

            Thanks. I changed it to
            <url-pattern>/servlet/ResponseDemoServlet</url-pattern>
            and it works.