• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

problem using my user defined class in my JSP page

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to define a class and use it in my JSP page, but i'm running
into some problems...

here is the JSP code:


here is the code for the class:



here is the error message:




I'm not sure why i keep getting this error. I've even tried changing:
"DbClass dbinstance;" to "DbClass dbinstance = new DbClass();" and I
get the following error:




i have NO IDEA what this error is trying to tell me...can anyone help?

Thanks in advance,
--Lucas
 
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

variable dbinstance might not have been initialized



Says it all. You are declaring a variable without initializing it prior to its first reference.
 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you elaborate a little as to what i am doing wrong? if you read further down i have....

Originally posted by Lucas Mach:

I'm not sure why i keep getting this error. I've even tried changing:
"DbClass dbinstance;" to "DbClass dbinstance = new DbClass();" and I
get the following error:




i have NO IDEA what this error is trying to tell me...can anyone help?



i see what the error says...i'm asking WHAT SHOULD I DO TO FIX IT?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Typing in all capital letters is equal to screaming at people in the forum and is considered rude.
This usually has the opposite effect from what you wanted as some people will refuse to help someone who screams at them.
 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, it's just a little upsetting when instead of helping people just tell me exactly what the compiler is telling me....
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The compiler was giving you the answer.
Bear was just pointing that out to you.
 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, but, in 2 of my posts i also mentioned......

Originally posted by Lucas Mach:
I've even tried changing:
"DbClass dbinstance;" to "DbClass dbinstance = new DbClass();" and I
get the following error:




i have NO IDEA what this error is trying to tell me...can anyone help?

Thanks in advance,
--Lucas[/QB]

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would start by using System.out.println("here") to locate where, exactly in the JSP it is blowing up.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have used

PreparedStatement sql;

in your code but you are not using variable sql anywhere in your code.

Try removing that line.
 
Bear Bibeault
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

instead of helping people just tell me exactly what the compiler is telling me



You said that you did not understand what the error meant. I was pointing it out. You're welcome.
 
Lucas Mach
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I said I didn't know what the second error meant (the one i got after i did initialize it). The first error, that you are referring to, i said i didn't know why i was getting it, not i didn't know what it meant. Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All over now.
Did you get it working?
 
Bear Bibeault
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There isn't much info on that error to go by. The most useful piece of info is probably:

at org.apache.jsp.auth_jsp._jspService(auth_jsp.java:100)



The exception is being thrown from line 100 of the java servlet created on behalf of auth.jsp. Find that java file (Tomcat will have written it to the folder hierarchy under $CATALINA_HOME/work) and see what is going on at line 100.
 
reply
    Bookmark Topic Watch Topic
  • New Topic