aspose 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
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: 24

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: 42264
    
  64
Post the entire path name of the HTML file, and describe the general layout of directories and files.


Ping & DNS - my free Android networking tools app
Mphatheleni Ernest Matidze
Greenhorn

Joined: Oct 10, 2012
Posts: 24

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: 24

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
Ranch Hand

Joined: Jul 06, 2011
Posts: 30

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: 24

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