dcsimg
Cannot run JSP file ( calling a Bean) from the browser
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manish_Sharma
Posted On:   Friday, April 12, 2002 04:47 AM

I have this JSP page calling a JavaBean: <%@ page import="LibWeb.asms.Employee"%> using java beans from jsp Welcome to the company, <%=staff.getName()%>,please visit VisualBuilder.com to get more out of life! and i have this error while execution of JSP Error: 500 Location: /LibWeb/asms/first.jsp Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSP/apl07/libweb/jakarta-tomcat-3.2.1/work/localhost_8080%2FLibWeb/_0002fasms_0002ffirst_0002ejspfirst_jsp_0.java:15: Class LibWeb.asms.Employee not found in import. impo   More>>

I have this JSP page calling a JavaBean:

			
<%@ page import="LibWeb.asms.Employee"%>



using java beans from jsp





Welcome to the company,
<%=staff.getName()%>,please visit VisualBuilder.com to get more out of life!





and i have this error while execution of JSP

			
Error: 500
Location: /LibWeb/asms/first.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSP/apl07/libweb/jakarta-tomcat-3.2.1/work/localhost_8080%2FLibWeb/_0002fasms_0002ffirst_0002ejspfirst_jsp_0.java:15: Class LibWeb.asms.Employee not found in import.
import LibWeb.asms.Employee;
^
1 error

at java.lang.Throwable.(Compiled Code)
at java.lang.Exception.(Compiled Code)
at javax.servlet.ServletException.(Compiled Code)
at org.apache.jasper.JasperException.(Compiled Code)
at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(Compiled Code)
at org.apache.jasper.servlet.JasperLoader.loadJSP(Compiled Code)
at org.apache.jasper.servlet.JspServlet.loadJSP(Compiled Code)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(Compiled Code)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Compiled Code)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(Compiled Code)
at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.tomcat.core.ServletWrapper.doService(Compiled Code)
at org.apache.tomcat.core.Handler.service(Compiled Code)
at org.apache.tomcat.core.ServletWrapper.service(Compiled Code)
at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)
at org.apache.tomcat.core.ContextManager.service(Compiled Code)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compiled Code)
at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)




whats wrong?

my bean code:

			




package asms;
class Employee{
private String String_name;
public String getName()
{
return String_name;
}

public void setName(String name)
{
String_name = name;
}

public static void main(String args[]){
System.out.println("Manish");
}
}



on compiling the java file Employee.java we get the class file which gets executed but when we try to run the jsp file from the browser then we get the error as shown above.....i think we r not able to specify the path in the import statement..

Please help us out...

Do we have to compile the jsp file also...? if so how ...
Wht is the correct way to set the import path to be specified in the import stmt in the jsp?

   <<Less

Re: Cannot run JSP file ( calling a Bean) from the browser

Posted By:   Bear_Bibeault  
Posted On:   Wednesday, April 17, 2002 09:45 AM

This means pretty much what the error message says. The class file for your Employee class cannot be found at the time that the JSP is being compiled.


The JSP container will expect to find the class LibWeb.asms.Employee at location:



   WEB-INF/classes/LibWeb/asms/Employee.class


or withing a jar file in WEB-INF/lib.


hth,

bear

About | Sitemap | Contact