File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in simple bean and JSP

 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not understood beans properly and i am getting an error 500 : Cannot find any information on property 'name' in a bean of type 'cool.Person'.
Please help me to rectify this.

The jsp


The bean


web.xml

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64200
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a quick inspection I can't see anything glaringly incorrect, but why are you using antiquated <jsp:getProperty> instead of the EL and JSTL?

What happens if you replace the getProperty tag with <c:out value="${dude.name}"/>?

(assuming you've enabled the JSTL)
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A minor doubt? I may be missing something glaringly obvious. But where are you setting the bean?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64200
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vic Hood wrote:A minor doubt? I may be missing something glaringly obvious. But where are you setting the bean?

The <jsp:useBean> tag will create a bean in request scope if one with that name is not already resident.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree Bear , but where are the initial values for the bean being set?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64200
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They aren't, unless it's happening in a controller that we do not know about. The property may be null, but that will not result in the error that is being seen.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh okies, Thanks for the info
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
but why are you using antiquated <jsp:getProperty> instead of the EL and JSTL?

I did not know it was outdated. :confused: Why should i avoid using getProperty ?
I am using the head first book (1.5) and making working code out of the snippets in the book. Not reached the JSTL part yet.

Bear Bibeault wrote:
What happens if you replace the getProperty tag with <c:out value="${dude.name}"/>?
(assuming you've enabled the JSTL)


There is no error and i get a blank page. Why is that happening ? How to enable the JSTL ?

Thanks for telling me these new things. :)
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me how to make this work.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64200
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instructions on setting up the JSTL can be found in the JspFaq.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic