[NewBie] using a Java Class from a JSP

F

Federico

Hi all and please forgive me for this newbie question.

I should create and utilize the funcionts of a Java Class from a JSP
page contained in Tomcat.


I Should:

a) define a package containing this class and put it in the CLASSPATH

b) put the Java class in TomCat (folder WEB-INF/lib or WEB-INF/class)

c) a mix of both methods!??! (Classpath AND Tomcat)?!?

Thanks

Federico
 
D

Digby

Put it in WEB-INF/classes, or if you've put your classes in a .jar file,
stick it in WEB-INF/lib. Tomcat puts these paths on the CLASSPATH.
 
W

Wendy S

Federico said:
I should create and utilize the funcionts of a Java Class from a JSP
page contained in Tomcat.
I Should:
b) put the Java class in TomCat (folder WEB-INF/lib or WEB-INF/class)

Tomcat ignores the system classpath. You should put your class underneath
WEB-INF/classes [not 'class'!] in a directory structure mirroring the
package structure. Or in a .jar file with a similar directory structure
inside it, in WEB-INF/lib.

Be sure to put your class in a package, you'll get errors otherwise.
(Google will turn up the reason why if you're curious...)
 

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

Members online

Forum statistics

Threads
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top