|
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
ReloadTest.jsp
<%@ page language="java" import="examples.*" %>
<html>
<body>
The message is: <%= ReloadedClass.getMessage() %>
</body>
</html>
ReloadedClass.java
package examples;
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
|