• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp:setProperty

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic