File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes how to use java class in jsp or servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to use java class in jsp or servlet" Watch "how to use java class in jsp or servlet" New topic

how to use java class in jsp or servlet

mohan cheepu
Ranch Hand

Joined: Nov 15, 2007
Posts: 49
i some java class.i want use those class at serverside in tomcat server. how using jsp or servlets calling those java class.please give me advice.what is dirctory structure.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410


Welcome to the ranch.

If you're new to servlets or JSP, I's suggest picking up a good book or finding a good web tutorial. Your question doesn't make a lot of sense because servlets are Java classes. JSPs eventually become Java classes as well. If you follow current best practices your JSP is the end result of a chain of Java classes that are invoked and referenced by one another.

As to directory structure, class files go under {webapp}/WEB-INF/classes/{package structure}/{.class files}

If you bundle your Java classes into jar files, the jars go under WEB-INF/lib.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: how to use java class in jsp or servlet