3 Replies Latest reply on Apr 12, 2004 2:31 AM by toonice

    Failing to import in JSP

    toonice Newbie

      I've made a package and I need to import it inside a JSP page located in deploy/directory.war.
      However JBoss doesn't seem to be finding it. Where do I put the package, and is there an xml I need to edit to show the classpath?


        • 1. Re: Failing to import in JSP
          tonytse Newbie

          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 Newbie

            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() {


            package project;
            <%@ page import = "project.Thing" %>
            Thing test = new Thing();

            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 Newbie

              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.