Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

jsp:useBean

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying out the foo.Person example in HFSJ. I get the following error...
org.apache.jasper.JasperException: /result1.jsp(4,0) The value for the useBean class attribute foo.Person is invalid.

Person class is present in web-inf\classes\foo
in my servlet in have
request.setAttribute("Person","<an object of foo.Person class>");

in my jsp I have
<jsp:useBean id="Person" class="foo.Person" scope="request"/>

What am I doing wrong? Why am i getting this error message?

It works fine when I use scripting, but with useBean tag I face the above error.

 
Ramya Iyer
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Resolved it. The bean class should have a no arg constructor when jsp:useBean is along with the class attribute
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A java bean should always have a zer0-arg constructor.
 
reply
    Bookmark Topic Watch Topic
  • New Topic