wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:setProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:setProperty" Watch "jsp:setProperty" New topic
Author

jsp:setProperty

shanthisri mocherla
Ranch Hand

Joined: Sep 05, 2005
Posts: 119
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 ]

[My Blog]
All roads lead to JavaRanch
shanthisri mocherla
Ranch Hand

Joined: Sep 05, 2005
Posts: 119
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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>
 
jQuery in Action, 2nd edition
 
subject: jsp:setProperty
 
Similar Threads
Scriptless JSPs
Concrete class problem in EL
Request to Bean
Error on basic jsp...
jsp:useBean doubt