aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes useBean error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "useBean error" Watch "useBean error" New topic
Author

useBean error

Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
Hi, I am trying to use useBean standard action by using a simple bean with property as name.
Here is my Person.java

I placed Person.class in WEB-INF/classes/com/example/model.

Here is the jsp in which I am trying to print property "name" value using jsp:useBean and jsp:getProperty.

standard_action.jsp


I am getting the following exception and not able to find the root cause from the information displayed.

org.apache.jasper.JasperException: /standard_action.jsp(7,0) The value for the useBean class attribute com.example.model.Person 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:1175)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1117)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2164)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2214)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2220)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2164)
org.apache.jasper.compiler.Generator.generate(Generator.java:3322)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)



Can some one point out the mistake I am doing here.
Thanks


SCJP 1.4
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
I have given explicit default constructor in the bean now , still getting same error.
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

It's strange. What happens if you declare private the 'name' member variable in Person class?


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
ST,
I changed property to be private. Still error is same.
Rajitha Arun
Ranch Hand

Joined: Aug 24, 2006
Posts: 43
I tried your example (copy - pasted). It works fine. Are you sure you have placed the bean in the right directory?


Rajitha
SCJP, SCWCD
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
Yes Rajee. I have placed it in WEB-INF/classes/com/example/model folder. Not sure what is going wrong here. Even the logs mention the same stack trace as mentioned in my first post.
Here is my web.xml.


I kept Jsp in Actions folder of webapps.
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
I deleted everything and wrote again. It started working now. Probably it was taking cached jsps.
Thanks everybody.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: useBean error