Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
JTurbo Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 23
Product ServletExec
Category JSP
Question Why can't my JSP page find my bean/helper class?
Answer First of all, make certain that the Bean/Helper class is visible to ServletExec, either by it's location on the hard-drive or by specifying it on the Main ServletExec Classpath:
For web applications, the class could be placed in the
...\WEB-INF\classes\ folder
or in a JAR file placed at:
...\WEB-INF\lib\


Or you could have the class reside in a "neutral" location (not inside a webapp) and add it to the Main SE Classpath where all webapps (and the Legacy context) can see it.
This would be the only option for JSPs running in the Legacy context (Legacy context is only possible prior to SE 5.0). If your JSPs are running in the Legacy context, placing your helper classes in the Legacy Servlets folder won't help.


Secondly, you need to understand that a JSP is compiled into a Servlet, and with ServletExec, that servlet is declared to be part of the "pagecompile" package. So if your JSP wants to use a Bean/Helper class then you will need to add a page directive to your JSP, importing the package of the Bean/Helper class.

NOTE:
  • With JDKs prior to JDK 1.4:
    If the bean/helper class is not in a package then you will need to add the following import statement to your JSP:

    <%@ page import="<bean class name>" %>
  • With JDK 1.4 or newer:
    Your bean/helper class MUST be part of a package. Otherwise, the java compiler will not compile the generated servlet, and will complain about expecting a '.' character in the name of the imported class. With JDK 1.4 and newer, the Java compiler is more restrictive in this case.



   
company media information terms of use privacy policy contact us