London guy
London guy

Reputation: 28032

This is not calling the servlet

I have this code

<form method="post" action="localhost:8080/WelcomeServlet">
  <select name="Signal_Drop">
    <option value="True">True</opion>
  </select>
  <select name="Video_Glitch">
    <option value="True">True</option>
  </select>
  <select name="Call_Drop">
    <option value="True">True</option>
  </select>
  <input type="Submit" value="Submit">
</form>

When I click the submit button, the page is not changing. Nothing happens. It is not calling the servlet.

Upvotes: 0

Views: 643

Answers (4)

Abderrazak BOUADMA
Abderrazak BOUADMA

Reputation: 1606

first you've a small html bug at line 3 </opion> instead of </option>

second , I agree with the two first answers avoid absolute urls as the server will resolve the url automagicaly.

web.xml

    <servlet>
    <servlet-name>welcome</servlet-name>
    <servlet-class>com.lab.WelcomeServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>welcome</servlet-name>
    <url-pattern>/WelcomeServlet</url-pattern>
</servlet-mapping>

your form

<body>
<form method="post" action="WelcomeServlet">
    <select name="Signal_Drop">
        <option value="True">
            True
            </option>
    </select> <select name="Video_Glitch">
        <option value="True">True</option>
    </select> <select name="Call_Drop">
        <option value="True">True</option>
    </select> <input type="Submit" value="Submit">
</form>

Hope it'll help you

Upvotes: 0

Reimeus
Reimeus

Reputation: 159864

Better to use:

<form method="post" action="/WelcomeServlet">

Upvotes: 2

oleg
oleg

Reputation: 197

Instead of

localhost:8080/WelcomeServlet

write

/WelcomeServlet

It's not very good to write absolute address here.

Upvotes: 0

user647772
user647772

Reputation:

Write

http://localhost:8080/WelcomeServlet

instead of just

localhost:8080/WelcomeServlet

And you perhaps have to add the context of your WAR before the Servlet name.

Upvotes: 3

Related Questions