• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
  • Mark post as helpful
  • send pies
  • 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: 43016
76
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Hi mak pandian, thanks I will always note that.
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic