Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 - /Beer-v1/form.html

 
Tom Nishan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP Status 404 - /Beer-v1/form.html

Hello everyone,

I have a problem when I trying to open form.html file.
I installed Tomcat 5.5 and when I run tomcat I can see welcome page.

Tomcat5/webapps/Beer-v1/WEB_INF/web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"
<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/web-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>/SelectBear.do</url-pattern>
</servlet-mapping>

</web-app>

Tomcat5/webapps/Beer-v1/form.html:

<html><body>
<h1 align="center">Beer Selection Pages</h1>
<form method="POST"
action="SelectionBeer.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">
</center>
</form></body></html>

Please help. Thank you in advance.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What URL are you using to access form.html? And what error are you getting?
 
Tom Nishan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your quick response.
I'm using the following URL:

http://localhost:8080/Beer-v1/form.html

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the context even running? Use the Tomcat Manager app to find ut.

See the Tomcat FAQ if you don't already have the Manager app configured.
 
ankittt agarwala
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think there is a little error in html coding part
you didnot use '>' in form line
<form...............
..................where is '>'
but besides that there is some more error which is not making you open this page
do one thing if you are able to see the welcome page on entering http://localhost:8080/ then your tomcat is configured rightly
use the latest version of tomcat as it has removed many bugs of previous versions
 
Tom Nishan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys!

I installed Tomcat 7 and I got welcome page.
I still got the same error.

HTTP Status 404 - /Beer-v1/form.html

type Status report

message /Beer-v1/form.html

description The requested resource (/Beer-v1/form.html) is not available.

Apache Tomcat/7.0.5
 
ankittt agarwala
Ranch Hand
Posts: 42
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think your form.html is not a html file actually its a notepad file with name form.html
do you get a webpage on opening it directly by double clicking it??
if yes then do the following thing
write the following code in a notepad file and click save as
there name it as form.html and in type press "all files" and then save it
in tomcat webapps directory make a new folder t and paste the above form.html file in t
now start tomcat and open the link http://localhost:8080/t/form.html
now it should open.
code

<html>
<h1 align ="center">this is a page</h1>
<form method="post"
action ="selecttea.do">
select tea characteristics<p>
color:
<select name ="color" size="1">
<option value="light"> light </option>
<option value="amberr"> amberr </option>
<option value="orange"> orange </option>
<option value="green"> green </option>
</select>
<br><br>
<center>
<input type="submit">
</center>
</form>
</body>
</html>
dont define any xml file thats dd or anything else this is just to check your form.html
remember the form.html should appear to you as only form(without the html extension) in the t directory after saving
 
Tom Nishan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You were right, Ankittt. I got the result as shown in the book. Thank you Ankittt. I really appreciate it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic