Hi all,
I am a newbie in jsp and this may be a simple question.
I am trying to call a servlet from a jsp file and display the result in JavaWebServer1.2.
The DBPhoneLookup.jsp is in JavaWebServer1.2\public_html directory and looks like this:
<HTML>
<HEAD>
Accessing DBPhoneLookup servlet
</TITLE>
</HEAD>
<BODY>
<H2> The servlet is used to access the Employees database </H2>
<HR>
<servlet name="DBPhoneLookup" code="JdbcServlet.DBPhoneLookup.DBPhoneLookup" codebase="file:/C:/TestServlets"> </servlet>
</BODY>
</HTML>
 
The DBPhoneLookup.java file, which implement the servlet, desribed in J.Hunter book, is located
in C:\TestServlets directory and has the package statement: package JdbcServlet.DBPhoneLookup.
 
While running: http://localhost/DBPhoneLookup.jsp I have the following errors:

The servlet named pageCompile at the requested URL

http://localhost/DBPhoneLookup.jsp
reported this exception Cannot load servlet: name=DBPhoneLookup code=JdbcServlet.DBPhoneLookup.DBPhoneLookup codebase=file:/C:/TestServlets/. Please report this to the administrator of the web server.

javax.servlet.ServletException: Cannot load servlet: name=DBPhoneLookup code=JdbcServlet.DBPhoneLookup.DBPhoneLookup codebase=file:/C:/TestServlets/ at com.sun.server.http.pagecompile.PageCompileServlet.loadServlet(PageCompileServlet.java:1420) at com.sun.server.http.pagecompile.ServletUtil.loadServlet(ServletUtil.java:98) at pagecompile._DBPhoneLookup_xjsp.service(_DBPhoneLookup_xjsp.java:53) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at com.sun.server.http.pagecompile.PageCompileServlet.doService(PageCompileServlet.java:792) at com.sun.server.http.pagecompile.PageCompileServlet.doGet(PageCompileServlet.java:547) at javax.servlet.http.HttpServlet.service(HttpServlet.java:499) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at com.sun.server.ServletState.callService(ServletState.java:214) at com.sun.server.ServletManager.callServletService(ServletManager.java:985) at com.sun.server.ProcessingState.invokeTargetServlet(ProcessingState.java:390) at com.sun.server.http.HttpProcessingState.execute(HttpProcessingState.java:93) at com.sun.server.http.stages.Runner.process(Runner.java:79) at com.sun.server.ProcessingSupport.process(ProcessingSupport.java:260) at com.sun.server.Service.process(Service.java:203) at com.sun.server.http.HttpServiceHandler.handleRequest(HttpServiceHandler.java:387) at com.sun.server.http.HttpServiceHandler.handleRequest(HttpServiceHandler.java:203) at com.sun.server.HandlerThread.run(HandlerThread.java:157)
I tried in DBPhoneLookup.jsp to change: code="DBPhoneLookup.class" codebase="file:/C:/TestServlets/JdbcServlet/DBPhoneLookup".
The result was similar to the previous one.
I would appreciate if anyone could tell the right way to acces the servlet from a jsp file.
 
 
 

Reply via email to