File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Help in running html form in tomcat 7, please help im stuck Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help in running html form in tomcat 7, please help im stuck" Watch "Help in running html form in tomcat 7, please help im stuck" New topic
Author

Help in running html form in tomcat 7, please help im stuck

Mphatheleni Ernest Matidze
Greenhorn

Joined: Oct 10, 2012
Posts: 23

Hi, I am trying to complete the Head First Servlets and Jsp 2nd edition example on chapter 3, I am using tomcat 7.0.32, and Java 6 (im studying oce 6 wcd)
when i type http://localhost:8080/ it works and displays the tomcat page to show that the port number is fine, but when i test my html page http://localhost:8080/Beer-v1/form.html it shows this error.

HTTP Status 404 - /beer-v1/form.html
--------------------------------------------------------------------------------
type Status report

message /beer-v1/form.html

description The requested resource is not available.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.34

here is my html page
-----------------------
<!DOCTYPE html>
<html><body>
<h1 align=”center”>Beer Selection Page</h1>
<form 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>
<br><br>
<center>
<input type="submit" value="ok" />
</center>
</form></body></html>
-----------------------------------------------------------------------------
and my web.xml
-------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<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>

my deployment and development directory is fine think, i structured it according to the HF book.
Please someone help, and thank you.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Post the entire path name of the HTML file, and describe the general layout of directories and files.


Ping & DNS - updated with new look and Ping home screen widget
Mphatheleni Ernest Matidze
Greenhorn

Joined: Oct 10, 2012
Posts: 23

My deployment directory is C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.34\webapps\beer-v1
my development directory is C:\Users\ModernWarFare\Desktop\MyProject\beerV1

i have put the html form on both the deployment directory and development directory as follows:

development directory: C:\Users\ModernWarFare\Desktop\MyProject\beerV1\web\form.html
deployment directory: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.34\webapps\beer-v1\form.html

my deployment descriptor web.xml is also on both development and deployment directories as follows:

development directory: C:\Users\ModernWarFare\Desktop\MyProject\beerV1\etc\web.xml
deployment directory: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.34\webapps\beer-v1\WEB-INF\web.xml

so far thats the only files i created, im trying to test the html form. thanks.

Mphatheleni Ernest Matidze
Greenhorn

Joined: Oct 10, 2012
Posts: 23

Fortunately i fixed it yesterday the problem was on my deployment descripter, i made a syntax error in the servlet mapping block

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

mak pandian
Greenhorn

Joined: Jul 06, 2011
Posts: 25

Hi Mphatheleni Ernest Matidze.

It's always good practice that make sure the context path (http://localhost:8080/webapp) is working fine. If it does not, obviously bug must be in deployment descriptor(web.xml)
Mphatheleni Ernest Matidze
Greenhorn

Joined: Oct 10, 2012
Posts: 23

Hi mak pandian, thanks I will always note that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help in running html form in tomcat 7, please help im stuck
 
Similar Threads
Headfirst ch3 Beerselect submit button not working
Cannot bring up a html page using tomcat 6.0
Problem with servlets
Servlet Doesn't appear to be working.
Error on my first aplication