On 21/08/2009 23:50, Tena Sakai wrote:
Hi folks,
I am confused about beans.
And apparently about how a servlet based web application ought to be
built. You should start by reading the Servlet Specification and
gaining an understanding of what you're trying to build.
I think it has to do with the CLASSPATH and my lack of understanding
for sure.
Definitely the former, probably the latter.
Never set the CLASSPATH when using Tomcat.
My platform is a linux machine with
tomcat 6.0.14. Here's the lay of the land.
Why not use 6.0.20? It's the most recent version.
Under $CATALINA_HOME/webapps/ I have created
a directory called my-jsp, in which there are
three files:
GetName.html
SaveName.jsp
UserData.java
The correct procedure is to place an application in the webapps dir.
$CATALINA_HOME/webapps/mywebapp
which will be available under
http://host:8080/mywebapp/
The proper structure for a web application is like this:
mywebapp/index.jsp
mywebapp/page.jsp
mywebapp/WEB-INF/web.xml
mywebapp/WEB-INF/lib
mywebapp/WEB-INF/classes
mywebapp/META-INF/context.xml
I suspect you've probably configured the context in server.xml, this is
discouraged, put it in the META-INF as above, instead. Don't set the
path or docBase attributes.
GetName.html looks like:
SaveName.jsp looks like:
And UserData.java looks like:
UserData.java compiles fine. I moved UserData.class file
into $CATALINA_HOME/common/lib/user directory.
Put it in the webapp classes dir instead, it's no use there.
Only put .jar files in a lib directory.
My CLASSPATH variable says:
CLASSPATH=/usr/local/src/apache-tomcat-6.0.14/common/lib:and-on-and-on
Again: don't set this for web applications.
When I point my browser to http://myhost:8080/my-jsp/GenName.html,
I get a form, which I fill and press the submit button. Here's what
happens:
HTTP Status 500 -
It's a miracle that anything happened at all.
I have stared at this for a long, long minutes, but I see nothing wrong.
Can somebody please clue me in as to what I am doing wrong?
I strongly recommend a thorough reading of the documents on the Tomcat
website, and thorough examination of each of the example applications
that comes with the standard Tomcat download, before you proceed further.
http://tomcat.apache.org/
p
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org