• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Is my javaBean a javaBean?

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic