This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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

 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post the entire path name of the HTML file, and describe the general layout of directories and files.
 
Mphatheleni Ernest Matidze
Greenhorn
Posts: 25
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>


 
Ranch Hand
Posts: 30
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi mak pandian, thanks I will always note that.
reply
    Bookmark Topic Watch Topic
  • New Topic