Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-16-2009, 08:07 PM #1
- Join Date
- Feb 2009
- Thanked 0 Times in 0 Posts
How to call a Java class from a JSP
Hello every body
I am learning JSP from a e-book "Teach Yourself JSP 2.0 with Apache Tomcat in 24 Hours (Sams, 2003)". here actually an example is given where we have to call a class from a JSP by importing it.
here is the code
<%@ page language="java" import="examples.*" %>
The message is: <%= ReloadedClass.getMessage() %>
public class ReloadedClass
public static String getMessage()
return "This is the original message";
Can some one please help me i actually dont know where to place the ReloadedClass.class file. And one more thing i have not actually used the package named 'examples'. i am using the Apache Tomcat Server so please guide me where should i place the .class file and under which folder.
right now i am placing the class file under "\Tomcat\webapps\examples\WEB-INF\classes\" the default place for placing class files as that of servlets
02-17-2009, 05:06 AM #2
- Join Date
- Jan 2009
- Thanked 5 Times in 5 Posts
It's okey to put the ReloadedClass class file in WEB-INF/classes folder.
one more thing i have not actually used the package named 'examples'
Look at J2EE web application directory structure