0

I have a package called asd and under it a servlet MyClass, i am using web.xml to configure the servlet and a form tag on index.html.

<servlet>
  <servlet-name>MyClass</servlet-name>
  <servlet-class>asd.MyClass</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>MyClass</servlet-name>
  <url-pattern>/asd/MyClass</url-pattern>
</servlet-mapping>

And the form tag

<form action="asd.MyClass" method="get">
  <input type="submit"/>
</form>

I have already tried making another servlet without the package with the same code configured properly and it works. So I image the problem have to do with the configuration of the package in servlet-class, url-pattern and action

T4l0n
  • 595
  • 1
  • 8
  • 25

1 Answers1

1

Your form should submit to the URL your servlet is mapped to in url-pattern within the servlet-mapping. You need action set to asd/MyClass.

<form action="asd/MyClass" method="get">
    <input type="submit"/>
</form>
Weave
  • 211
  • 2
  • 4