from the search I made I understood that I must declare the class in a package then put it in WEB-INF/classes. and call it from the jsp page.
SO. my class is:
package x.com;
import java.io.*;
public class X
{
public static void main(String[] args ) throws IOException
{
File myFile = new File("/usr/local/tomcat/webapps/CMMAC/web/temp");
myFile.deleteOnExit();
}
}
then I created classes ----> x ----> com ----> and then I put X.class in it.
then I'm calling the class from the JSP page as follows:
<%@ page import="x.com.*" %>
if(line.startsWith("0005"))
X();
the error returned is as follows:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 26 in the jsp file: /web/CMMAC.jsp
The method X() is undefined for the type CMMAC_jsp
23: line=line+normal;
24: }
25: if(line.startsWith("0005"))
26: X();
27: else
28: {
29: line=line.toLowerCase();
okay. so I suspect the problem is in the way I call it. I think I'm calling it the wrong way. so given all the information that I attached, where is the problem?
is it the package place? wrong code? wrong way of call? bad import?
and thx