• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean doesn't create a new bean

 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFSJSP, page 350 says that <jsp:useBean> can also create a bean.

I tried a simple program and I'm seeing below exception:


I further looked into the generated JSP file and it is different from what has been shown in the book:


Can someone please explain why it is not creating a new Person bean and instead throwing an exception?

Thanks!
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is model.Person a concrete class? Does it have a public, no-arguments constructor?
 
Faisal Ahmad
Ranch Hand
Posts: 355
Chrome Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply!

I read few more pages further and found my mistake:


I didn't specify class.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do not specify a class, no bean will be created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic