• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with servlets

 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guies,
I have still a problem.
I am using Tomcat in windows 7.
I am getting my "form.html" in web browser but after selecting submit button nothing is going to be happen.

My all codes are correctly compiled also without errors.
 
Stefan Evans
Bartender
Posts: 1782
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's nice.
What url are you accessing form.html on?
What do you expect to happen when you select the submit button?
 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have entered "http://localhost:8080/Beer-v1/form.html" in web browser and I got the "form.html" page also. But after click on submit button it should show following on web page:

Beer Selection Advice
Got Beet color brown

But it is not showing anything even error message also. It just show me form.html only
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be any number of things. Maybe your HTML isn't right and your submit button doesn't do anything. Or maybe a lot of other things. But we don't know anything at all about your problem except that you have some HTML. So start by looking at that. Make sure the submit button is in a form which is configured correctly for a start. If not, then move on to the next step.
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action is the action attribute of your form? It sounds like the action might be sending the request to the form.html page instead of the url mapped to your Servlet. It might help if you shared some code.
 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My html code is same as in book

--form.html---
<html>
<body>
<h1 align = "center">Beer Selection Page</h1>
<from method = "POST" action = "SelectBeer.do">
Select Beer Characteristics<p>
Color:
<select name = "color" size = "1">
<option value = "light" > light </option>
<option value = "amber" > amber </option>
<option value = "brown" > brown </option>
<option value = "dark" > dark </option>
</select>
</p>
<br><br>
<center>
<input type = "SUBMIT">
</center>
</from>
</body>
</html>

And the other java files are compiled without errors.

---web.xml---
<web-app xmlns = "http://java.sun.com/xml/ns/j2ee"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee/ewb-app_2_4.xsd"
version="2.4">

<servlet>

<servlet-name>Ch3 Beer</servlet-name>

<servlet-class>com.example.web.BeerSelect</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Ch3 Beer</servlet-name>

<url-pattern>/SelectBeer.do</url-pattern>

</servlet-mapping>

</web-app>
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same as the book? Are you sure? I don't think so... look more closely.
 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.
Its working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic