-
1. Re: Failing to import in JSP
tonytse Apr 12, 2004 1:35 AM (in response to toonice)You just need to put your package file i.e. JAR file in the deploy directory.
(It will load your class automatically)
And in your jsp file:
<%@page import ="org.xx.xxx.cls" %>
Is it okay?
:-) -
2. Re: Failing to import in JSP
toonice Apr 12, 2004 2:27 AM (in response to toonice)Thanks for the reply.
Is it necessary to jar the files? I seem to be getting further, the JSP doesn't complain about the import or my attempt at instantiating an object.. But for some reason I can't seem to retrieve any data from the object.
My directory structure is as follows:
jboss\server\all\deploy\something.war\project\thing.class compiled from
package project;
public class Thing {
public String t = "help";
public Thing() {
}
}
jboss\server\all\deploy\something.war\test.jsp
package project;
<%@ page import = "project.Thing" %>
<%
out.println("test");
Thing test = new Thing();
//out.println(test.t);
%>
I was hoping that the page would print out "test" followed by "help" but instead, I am getting the following error:
org.apache.jasper.JasperException: tried to access field project.Thing.t from class org.apache.jsp.test_jsp
[...]
I am slightly puzzled here.. I apologise if its something blatently obvious but would much appreciate some help. -
3. Re: Failing to import in JSP
toonice Apr 12, 2004 2:31 AM (in response to toonice)Oops.. Bad cut and paste and no edit button..
Please ignore that the "package project" line for the JSP, and the commented out out.println (I was just making sure that the jsp worked with that line commented out.