problems compiling jsp code

i dont know what is going on here is my jsp code.

<%@ page language="java" import="examples.*" %>

<html>

<body>

The message is: <%= ReloadedClass.getMessage() %>

</body>

</html>

and here is my ReloadedClass.java

package examples;

publicclass ReloadedClass

{

publicstatic String getMessage()

{

return"This is the original message";

}

}

and my jsp code is in webapps/root/ch05

and my java file is in webapps/root/ch05/examples

[949 byte] By [lrngjavaa] at [2007-11-27 1:23:34]
# 1

and here is the error

C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\CH05\ReloadTest_jsp.java:45: cannot find symbol

symbol : variable ReloadedClass

location: class org.apache.jsp.CH05.ReloadTest_jsp

out.print( ReloadedClass.getMessage() );

^

lrngjavaa at 2007-7-12 0:13:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

You need to compile your class ReloadedClass.java into ReloadedClass.class.

The class should then go into the WEB-INF/classes directory for your web application.

If you are using the ROOT web application, then the file ReloadedClass.class needs to be in the directory

webapps/root/WEB-INF/classes/examples/Reloaded.class

evnafetsa at 2007-7-12 0:13:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thankyou so much evan it worked. can i ask one more question? just last one i have given you all the dukes.i am having problem in deploying the war file once i am done then i am good to go with the whole book. Please help if you canMessage was edited by: lrngjava
lrngjavaa at 2007-7-12 0:13:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

A WAR file is pretty much just a zipped up web application.

With Tomcat all you have to do is put the war file in the webapps directory, and it will autodeploy itself. Thats all there is to it.

Most web applications do NOT use the root web context. Instead they define their own web context. Each web application is defined by the presence of a web.xml file: /webapps/[contextName]/WEB-INF/web.xml

A war file MyContext.war will expand into a web application MyContext, which you access at http://localhost:8080/MyContext

Does that help with your WAR file issues?

Cheers,

evnafets

evnafetsa at 2007-7-12 0:13:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...