• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is my javaBean a javaBean?

 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry if I posted this in the wrong forum.

Here's my problem...
I have a javaBean that writes stuff to the database to be saved.
It works fine when I use a testing Class to invoke the bean's method to write some dummy variables.

When I deployed it on a JSP page, I received the following error.

"org.apache.jasper.JasperException: /checkout.jsp(4,0) The value for the useBean class attribute limited.InsertDataBean is invalid.
"

I should think my bean met the bean requirements. But I can't find out what's wrong. Any help would be really really really great..

Here's my insertDataBean code

 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There error you received has to do with the JSP syntax you used to import the bean, not a problem with the bean itself (Jasper's job is to turn JSP into java code, not to make sure you followed good programming practices while designing your bean)
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I have the following tags in my JSP.

<jsp:useBean id="cart" scope="session" class="limited.CartBean" />
<jsp:useBean id="idBean" scope="page" class="limited.GetOrderIDBean" />
<jsp:useBean id="databean" scope="page" class="limited.InsertDataBean" />

Only the third failed to compiled.



Nothing's looking wrong.....or is there...

 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On further inspection, your default constructor isn't public and must be to be used with the useBean tag.
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm...

When I included the public infront of the empty constructor, it still couldn't work.

But when I deleted the constructor away, it's able to work again.

Oh my!! It works now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic