Claudio Donat�

Greenhorn
+ Follow
since Dec 02, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Claudio Donat�

This is the code to my servlet.



This is the Listener code.

17 years ago
This is the message that I am getting when I try to access the servlet:


[ December 07, 2006: Message edited by: Claudio Donat� ]
17 years ago
Rahul Bhattacharjee, Test.do is the name that I put on my web.xml archive to be the reference that the client uses to call the servlet. Like this:
<url-pattern>/Test.do</url-pattern>.

Ben Souther, I suppose my classes are ok because I copy them from the book Head first, Servlets and JSP. I check more than 1 time to see if I made a mistake there. The url that I am using is "http://localhost:8080/Beer-v1/Test.do", and it is the url that the book tell us to use.

Thanks for the reply people. I hope we can find out what I doing wrong.
17 years ago
People, when I put this path "http://localhost:8080/Beer-v1/Test.do" into my web browser instead of going to the servlet and creating a html page, the browser starts downloading of a Test.do type archive.

All my classes are ok and my web.xml is like this:

<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>Teste</servlet-name>
<servlet-class>com.example.ListenerTester</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Teste</servlet-name>
<url-pattern>/Test.do</url-pattern>
</servlet-mapping>

<context-param>
<param-name>breed</param-name>
<param-value>Beagle</param-value>
</context-param>

<listener>
<listener-class>
com.example.MyServletContextListener
</listener-class>
</listener>
</web-app>




Anyone knows what the problem is and how to fix it?

Thanks for the help.

Claudio
[ December 06, 2006: Message edited by: Claudio Donat� ]
17 years ago
Sorry to bother you again.

I set my CLASSPATH with the command set CLASSPATH=F:\Meu projeto\BeerV1\classes\com\example

Thats the path to the .class that has the BeerExpert class.

I also put the same PATH into Control Panel>System>advanced>Environment Variables>PATH

But the same error kips showing up.
17 years ago
Thanks for the reply.

But, how do I put them in the classpath?

I have followed all the steps that the book told me to follow, what am I missing here?
17 years ago
First of all, I want to say that my english is very poor, so please overlook my mistakes.

People, I'm having some problems.

I'm using Head First, Servlets ans JSP translated to brazilian portuguese.

And I am having the following problems.

This is the structure of my project:




And this is the structure of Tomcat:



In C:\Tomcat\webapps\Beer-v1\WEB-INF I have the web.xml, with the code:


Inside of F:\Meu projeto\BeerV1\src\com\example\web I have the BeerSelect.java with the code:



And inside of F:\Meu projeto\BeerV1\src\com\example\model I have the BeerExpert.java with the code:



Then, when I compile that's the message that I receive:

F:\Meu projeto\BeerV1>javac -d classes src\com\example\model\BeerExpert.java
Note: src\com\example\model\BeerExpert.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.



When I recompile whit -Xlint I recive this:


F:\Meu projeto\BeerV1>javac -Xlint -d classes src\com\example\model\BeerExpert.java
src\com\example\model\BeerExpert.java:13: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Jack Amber");
^
src\com\example\model\BeerExpert.java:14: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Red Moose");
^
src\com\example\model\BeerExpert.java:18: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Jail Pale");
^
src\com\example\model\BeerExpert.java:19: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Gout Stout");
^
4 warnings



Its possible that this is causing the problems?

Inside of F:\Meu projeto\BeerV1\classes\com\example\model and F:\Meu projeto\BeerV1\classes\com\example\web I have BeerExpert.class and BeerSelect.class, in this order.


When I compile, with de comand
javac -classpath c:/Tomcat/common/lib/servlet-api.jar -d classes src/com/example/web/BeerSelect.java
I receve this 3 errors:


src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();



I know it is a large code, and if anyone with a lot of patience could help me, I will be very, very thankful.


Tanks people!!!
[ December 02, 2006: Message edited by: Bear Bibeault ]
17 years ago