servlets problems

B

boyScout

Hello guys, I'm learnig java servelts but I got problems. I'using
tomcat as a container so I have a web application named so I created a
directory named jsp within the webapps' directory. After I have created
a web.xml file and a WEB-INFO directory inside my web application
directory then I put all classes inside the WEB-INFO/classes directory.
But nothing appear. Can someone help with that? Thanx
 
A

Andrew Thompson

boyScout said:
Hello guys, I'm learnig java servelts but I got problems. I'using
tomcat as a container so I have a web application named so I created a
directory named jsp within the webapps' directory. After I have created
a web.xml file and a WEB-INFO ...

Huhh? Did you mean 'WEB-INF' (no 'O')?
...directory inside my web application
directory then I put all classes inside the WEB-INFO/classes directory.

Only loose classes go in the classes directory, and
then by 'reverse package name', so for example...

<snippet>
package com.ourcompany;

public class TheClass {
....
</snippet>

...should be located as..

WEB-INF/classes/com/ourcompany/TheClass.class

OTOH, if your classes are in a jar, they need
to go in WEB-INF/lib.
But nothing appear.

Are you saying the 'classes are not found'?
Please try to give more detail of error output.

If none of the above works, don't forget to refresh
the server (restarting it is the easiest way).

HTH

Andrew T.
 
C

ck

Andrew said:
Huhh? Did you mean 'WEB-INF' (no 'O')?


Only loose classes go in the classes directory, and
then by 'reverse package name', so for example...

<snippet>
package com.ourcompany;

public class TheClass {
...
</snippet>

..should be located as..

WEB-INF/classes/com/ourcompany/TheClass.class

OTOH, if your classes are in a jar, they need
to go in WEB-INF/lib.


Are you saying the 'classes are not found'?
Please try to give more detail of error output.

If none of the above works, don't forget to refresh
the server (restarting it is the easiest way).

HTH

Andrew T.

Adding to what Andrew has said. You could make this simpler by just
creating a jsp file(index.jsp) and putting it inside your application
folder (in this case jsp folder and not WEB-INF).
Simply delete web.xml if it contains nothing or if its giving any error
during start up of the server.
In index.jsp you could put "hello world"

In your browser try to open it (http://127.0.0.1:8080/jsp/index.jsp I
am presuming that you would have not changed the port number)
I would also like to presume that you don't know how servlets can be
invoked. So you should refer some book, how to deploy a servlet.

Hope this helps

Cheers,
Ck
http://www.gfour.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,049
Members
48,769
Latest member
Clifft

Latest Threads

Top