1 Reply Latest reply on Jun 6, 2003 11:24 AM by Jon Barnett

    Accesing own classes in JSP

    ctellez_69 Newbie

      I have this problem: I developed a simple app using only one servlet, one JSP and a simple package with one class on it. I saved the package in "src/main/myjava". I also modified the .ant.properties and the build.xml file in order to get my classes compiled. Both, the servlet and the JSP make reference to the classes in the package named "contants" which is in the "build/classes" directory once the project is built.
      The servlet works fine, but I get this message when ths JSP is compiled:

      HTTP ERROR: 500 Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Generated servlet error: [javac] Compiling 1 source file [javac] C:\WINDOWS\TEMP\Jetty_0_0_0_0_8080__store\jsp_myapp_start_jsp.java:11: package constants does not exist [javac] import constants.*; [javac] ^ [javac] 1 error

      As you can see I get this message relative to rhe "constants" package, as if the JSP file doesn't find it, but the servlet find it with no problem.

      In the JSP I included the directive:
      <%@ page import="constants.*"%>

      when I delete this line the JSP works fine, but I need the info in the "constants" package.
      Any Idea how to get this done?

      Thanks in advance.

        • 1. Re: Accesing own classes in JSP
          Jon Barnett Master

          If you allow Jetty to compile the JSP, it will expect the supporting classes to be in:
          C:\WINDOWS\TEMP\Jetty_0_0_0_0_8080__store\webapp\WEB-INF\classes as would be expected when Jetty would normally work with a WAR deployment package.

          You could get ant to precompile the JSP under control of your deployment service and environment, and then place the compiled class with your servlet. This would be less troublesome than trying to second guess how to create the right environment for Jetty to compile your JSP.