*
The moose likes Servlets and the fly likes Problem with servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with servlets" Watch "Problem with servlets" New topic
Author

Problem with servlets

Praful Chandekar
Greenhorn

Joined: Jun 01, 2011
Posts: 8
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

Joined: Jul 06, 2005
Posts: 1016
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

Joined: Jun 01, 2011
Posts: 8
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: May 04, 2011
Posts: 144

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.


OCJP6, OCWCD5
Praful Chandekar
Greenhorn

Joined: Jun 01, 2011
Posts: 8
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Same as the book? Are you sure? I don't think so... look more closely.
Praful Chandekar
Greenhorn

Joined: Jun 01, 2011
Posts: 8
Thanks Paul.
Its working now.
 
Consider Paul's rocket mass heater.
 
subject: Problem with servlets
 
Similar Threads
Cannot find ActionMappings or ActionFormBeans collection
[n] Strange Variable Argument behaviour?
problem in instaling spring plugins into eclipse
Oracle9i Java Thin Driver
Error In package