aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes value for the useBean class attribute Invalid Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "value for the useBean class attribute Invalid Problem" Watch "value for the useBean class attribute Invalid Problem" New topic
Author

value for the useBean class attribute Invalid Problem

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634



i have a single java file name Person.java with:


UsingBean.jsp


upon running on server,i get the following Exception:

org.apache.jasper.JasperException: /UsingBean.jsp(10,0) The value for the useBean class attribute com.example.Employee is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1204)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1117)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Generator.generate(Generator.java:3384)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:220)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
com.example.ServletTwo.doPost(ServletTwo.java:51)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

if i make a new java file Employee.java with:


then there is no Exception.

can someone explain this anomaly ?



OCPJP 6.0 93%
OCPJWCD 5.0 98%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1717
    
  25

Employee is not visible outside the package com.example, so the web-container cannot instantiate it

Making Employee a public class solves the case.

Regards,
Frits
Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

Doesn't the name of the public class in a Java file have to match name of the file itself? Try making the Employee class public like Fritz said. If you are still having problems, try changing the name of the file to Employee.java instead of Person.java. It is probably better practice to have them as separate file anyway.


OCJP6, OCWCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: value for the useBean class attribute Invalid Problem