• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to compile class in JSP

 
casey Gould
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble getting my JSP page to recognize my Java Class (DbSettings) I believe my file directory is set up correctly below.

the issue is crashing at this line: rs = DbSettings.getResultSet

Can anyone point me into the right direction on how to get this resolved?

File Directory: Prj Name: Currency


DbSettings.java (Can't get this class recognized in JSP file)



JSP File snippet:




Stacktrace









 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you import DBSettings in the JSP?

Yet you ought to do all database stuff in a servlet.
 
casey Gould
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I go about importing the class in the jsp file?
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see you imported Calendar and ResultSet so I think you know how.
 
casey Gould
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I believe I have imported the class correctly

<%@page import="classes.DbSettings" %>

now I'm getting this error


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your first step should be to remove all Java code from your JSP as already suggested. Using Java scriptlets in a JSP is a bad practice from over 13 years ago. 13 years! It's high time that you catch up.
 
casey Gould
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a legacy site that I'm just making some changes too, I don't have nearly enough time to go through the site
 
Dave Tolls
Ranch Hand
Posts: 2284
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

is returning null.

Since you are checking for equality there then you should be using equalsIgnoreCase instead, which handles nulls, assuming null is a valid value here.

And you really should refactor as much of this as you can...it'll save tons of work. Then again, trying to explain that to the powers that be can be daunting.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's request.getParameter("action")? I believe this is null.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!