Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean

 
Ramya Iyer
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A java bean should always have a zer0-arg constructor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic