aspose file tools
The moose likes JSP and the fly likes Error in simple bean and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Error in simple bean and JSP" Watch "Error in simple bean and JSP" New topic
Author

Error in simple bean and JSP

Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

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


SCJP 6. Learning more now.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56521
    
  14

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)


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

A minor doubt? I may be missing something glaringly obvious. But where are you setting the bean?


Learning and Learning!-- Java all the way!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56521
    
  14

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

Joined: Jan 05, 2011
Posts: 477

I agree Bear , but where are the initial values for the bean being set?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56521
    
  14

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

Joined: Jan 05, 2011
Posts: 477

Oh okies, Thanks for the info
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

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

Joined: Jan 21, 2011
Posts: 637

Please tell me how to make this work.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56521
    
  14

Instructions on setting up the JSTL can be found in the JspFaq.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in simple bean and JSP
 
Similar Threads
jsp:useBean problem
Spring MVC - Url Handling Problem
ResourceBundle [/WEB-INF/messageresource/welcome] not found for MessageSource
How to invoke method using controller class in spring
how to read through property file