JSP not finding bean

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • catface
    New Member
    • Oct 2011
    • 1

    JSP not finding bean

    I am having problems running a JSP with a java class file on a Tomcat server.
    My files are located at:
    tomcat/webapps/ROOT/temp.jsp
    tomcat/webapps/ROOT/WEB-INF/classes/tempbeans/TempBean.class

    Code:
    <%@ page import="tempbeans.*" %>  <% TempBean bean = new TempBean(); %><%@ page import="tempbeans.*" %> 
    
    <% TempBean bean = new TempBean(); %>
    The contents of my class file.
    Code:
    package tempbeans;
    public class TempBean
    {
    
        public TempBean()
        {
        }
    }
    When I attempt to go to temp.jsp I get the following Exception:

    exception

    org.apache.jasp er.JasperExcept ion: Unable to compile class for JSP:

    An error occurred at line: 3 in the jsp file: /temp.jsp
    TempBean cannot be resolved to a type
    1: <%@ page import="tempbea ns.*" %>
    2:
    3: <% TempBean bean = new TempBean(); %>


    An error occurred at line: 3 in the jsp file: /temp.jsp
    TempBean cannot be resolved to a type
    1: <%@ page import="tempbea ns.*" %>
    2:
    3: <% TempBean bean = new TempBean(); %>


    Stacktrace:
    org.apache.jasp er.compiler.Def aultErrorHandle r.javacError(De faultErrorHandl er.java:97)
    org.apache.jasp er.compiler.Err orDispatcher.ja vacError(ErrorD ispatcher.java: 330)
    org.apache.jasp er.compiler.JDT Compiler.genera teClass(JDTComp iler.java:457)
    org.apache.jasp er.compiler.Com piler.compile(C ompiler.java:37 4)
    org.apache.jasp er.compiler.Com piler.compile(C ompiler.java:35 2)
    org.apache.jasp er.compiler.Com piler.compile(C ompiler.java:33 9)
    org.apache.jasp er.JspCompilati onContext.compi le(JspCompilati onContext.java: 601)
    org.apache.jasp er.servlet.JspS ervletWrapper.s ervice(JspServl etWrapper.java: 344)
    org.apache.jasp er.servlet.JspS ervlet.serviceJ spFile(JspServl et.java:389)
    org.apache.jasp er.servlet.JspS ervlet.service( JspServlet.java :333)
    javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:722)


    The code runs on my local Eclipse set-up? Is there something wrong with my remote set-up?
    Any help is greatly appreciated!!
Working...