This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Really need help on The requested resource (/SelectBeer.do) is not available. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Really need help on The requested resource (/SelectBeer.do) is not available." Watch "Really need help on The requested resource (/SelectBeer.do) is not available." New topic
Author

Really need help on The requested resource (/SelectBeer.do) is not available.

Jerry Bustamente
Ranch Hand

Joined: May 24, 2004
Posts: 90
I've spent alot of time chasing my tail, am at wits end and need your help.

I've examined other posts on this forum on this topic but did not find a resolution.

I am on page 81 of the great Head First Servlets & JSP book.

After typing http://localhost/form.html into Mozilla and pressing enter I get the page that asks for a color I click on a color then I click on Submit query and get:


The requested resource (/SelectBeer.do) is not available.

(I changed to port 8o and have successfully completed the configuration and tests from http://www.coreservlets.com/Apache-Tomcat-Tutorial/ Also, I can display form.html just fine in Mozilla. FYI, this site has great Tomcat setup information.)

Here is the syntax of the form.html, web.xml, and BeerSelect.java

form.html in C:\jakarta-tomcat-5.5.4\webapps\Beer-v1

<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>lightening
<option>amber
<option>brown
<option>dark
</select>
<br><br>
<center>
<input type="SUBMIT">
</center>
</form></body></html>

web.xml in C:\jakarta-tomcat-5.5.4\webapps\Beer-v1\WEB-INF

<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>/SelectBeer.do</url-pattern>
</servlet-mapping>

</web-app>

BeerSelect.java in C:\MyProjects\beerV1\src\com\example\web

package com.example.web;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeerSelect extends HttpServlet {

public void doPost

(HttpServletRequest request,
HttpServletResponse response)

throws IOException, ServletException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("Beer Selection Advice<br>");

String c = request.getParameter("color");

out.println("<br>Got beer color " + c);

}
}

The BeerSelect.java file was successfully compiled and copied to:

C:\jakarta-tomcat-5.5.4\webapps\Beer-v1\WEB-INF\classes\com\example\web

I restarted Tomcat as instructed and received the

The requested resource (/SelectBeer.do) is not available. message.

Your help is very appreciated.

Thank you,

Jerry Bustamente

ps Tomcat 5.5.4
Jerry Bustamente
Ranch Hand

Joined: May 24, 2004
Posts: 90
I found my error. I believe but do not know for certain that it had something to do with the syntactical alignment of form.html and/or web.xml. I corrected both members to be IDENTICAL to what is in the Head First book and it worked perfectly as a previous colleague mentioned on this forum.

However, being new to Tomcat I found alot of doc on web regarding setup neither useful or current with the exception of

http://www.coreservlets.com/Apache-Tomcat-Tutorial/

You can even download a working configuration. After setting up my development and deployment as documented in the Head First I also downloaded the pre-configured Tomcat to compare to my directory structure and contents.

Working through the Tomcat configuration at the above link was very educational.

Given that, the Head First Servlets & JSP is wonderful especially in their method of learning which seems cutting edge.

Thanks,

Jerry Bustamente
Jerry Bustamente
Ranch Hand

Joined: May 24, 2004
Posts: 90
I found my error. I believe but do not know for certain that it had something to do with the syntactical alignment of form.html and/or web.xml. I corrected both members to be IDENTICAL to what is in the Head First book and it worked perfectly as a previous colleague mentioned on this forum.

However, being new to Tomcat I found alot of doc on web regarding setup neither useful or current with the exception of

http://www.coreservlets.com/Apache-Tomcat-Tutorial/

You can even download a working configuration. After setting up my development and deployment as documented in the Head First I also downloaded the pre-configured Tomcat to compare to my directory structure and contents.

Working through the Tomcat configuration at the above link was very educational.

Given that, the Head First Servlets & JSP is wonderful especially in their method of learning which seems cutting edge.

Thanks,

Jerry Bustamente
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Really need help on The requested resource (/SelectBeer.do) is not available.
 
Similar Threads
Head First Servlet JSP: BeerSelect example: requested resource not available
Getting problem with post method
Tomcat 5.5 - application development
Problems with the Example from HF Servlets & JSP in Chapter 3
Headfirst ch3 Beerselect submit button not working