GeeCON Prague 2014*
The moose likes JSP and the fly likes problem using my user defined class in my JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "problem using my user defined class in my JSP page" Watch "problem using my user defined class in my JSP page" New topic
Author

problem using my user defined class in my JSP page

Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

variable dbinstance might not have been initialized


Says it all. You are declaring a variable without initializing it prior to its first reference.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
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?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
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

Joined: Dec 11, 2004
Posts: 13410

The compiler was giving you the answer.
Bear was just pointing that out to you.
Lucas Mach
Greenhorn

Joined: Mar 31, 2005
Posts: 15
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

Joined: Dec 11, 2004
Posts: 13410

I would start by using System.out.println("here") to locate where, exactly in the JSP it is blowing up.
smita raval
Greenhorn

Joined: Aug 31, 2002
Posts: 28
You have used

PreparedStatement sql;

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

Try removing that line.


Smita Raval
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

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

Joined: Mar 31, 2005
Posts: 15
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

Joined: Dec 11, 2004
Posts: 13410

All over now.
Did you get it working?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

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.
 
GeeCON Prague 2014
 
subject: problem using my user defined class in my JSP page