Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

org. apache. jasper. JasperException : Unable to compile class for JSP:

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
this is my first post and am new to java am trying to test the code given in headfirst jsp&Servlet

this is my very basic code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<table>
<tr>
<td>Enter FirstName : <input type="text" id="name" name="name"></td>
</tr>
<tr>
<td>Enter LastName : <input type="text" id="lastname" name="lastname"></td>
</tr>
</table>
<jsp:useBean id="person" class="PersonDetails">
<jsp:setProperty name="person" property="*" />
</jsp:useBean>

<input type="submit" value="Submit">


</body>
</html>

but i am getting this error

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 19 in the jsp file: /jsp/EntryPage.jsp
PersonDetails cannot be resolved to a type
16: <td>Enter LastName : <input type="text" id="lastname" name="lastname"></td>
17: </tr>
18: </table>
19: <jsp:useBean id="person" class="PersonDetails">
20: <jsp:setProperty name="person" property="*" />
21: </jsp:useBean>
22:


An error occurred at line: 19 in the jsp file: /jsp/EntryPage.jsp
PersonDetails cannot be resolved to a type
16: <td>Enter LastName : <input type="text" id="lastname" name="lastname"></td>
17: </tr>
18: </table>
19: <jsp:useBean id="person" class="PersonDetails">
20: <jsp:setProperty name="person" property="*" />
21: </jsp:useBean>
22:


An error occurred at line: 19 in the jsp file: /jsp/EntryPage.jsp
PersonDetails cannot be resolved to a type
16: <td>Enter LastName : <input type="text" id="lastname" name="lastname"></td>
17: </tr>
18: </table>
19: <jsp:useBean id="person" class="PersonDetails">
20: <jsp:setProperty name="person" property="*" />
21: </jsp:useBean>
22:


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)

what should i do

am using eclips , toncate 6 , xp

thank you
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

It looks as if the PersonDetails class is not in a package - all JSP beans need to be in a package.

You'll also need a JSP import statement for that package/class.
 
Lookout! Runaway whale! Hide behind this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic