• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:setProperty

 
shanthisri mocherla
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends
I'm going through HFSJ 361 page.where in I have to get the ouput as
person is:Kathy ID is : 343.

I've written the HTML form for this and I also wrote a JSP.And I have two files Person.java and Employee.javaand their corresponding classes as well.

HTML form(BeanTest.html)


TestBean.jsp



Person.java ;


Employee.java



I'm getting the output as Person is :null ID is :0

Can anyone please help me with this .

Thanks
Shanthi
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is probably not the problem, but first, try to remove spaces between the attribute, the '=' sign and the value in all your tags.
Like type = "foo.Employee" to type="foo.Employee".

PS : I've tried your code and it worked for me... (Tomcat 5.5)
[ January 16, 2006: Message edited by: Satou kurinosuke ]
 
shanthisri mocherla
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou
Thnaks for your help.I got the output as desired.But, I think the problem is not with the whitespaces but,something else.because when i tried the same code with the white spaces between '=' and "foo.employee".it worked fine.

Satou,I've one more question.
I got an error while doing some other exercise.
Like this:

org.apache.jasper.JasperException: Attempted a bean operation on a null object.
When do we get such errors?What could be the problem???


Thank you very much for your prompt reply.
Shanthi
[ January 16, 2006: Message edited by: shanthisri mocherla ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could have such error when using jsp:setProperty or jsp:getProperty on a bean which does not exist. For example, if the "name" attribute does not match the "id" attribute of <jsp:useBean>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic