• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

connection can not be resolved

 
Greenhorn
Posts: 12
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to connect a jsp page to a postgress database
i have created a jdbcconnects.java file and compiled it with jsp_api.jar from my apache..../lib directory

i have placed the class file in root/WEB-INF/classes folder

the code of my class file is




the jsp page i have is




i am getting a


An error occurred at line: 7 in the generated java file
The import Jdbcconnections cannot be resolved

An error occurred at line: 14 in the jsp file: /payroll/ddoregisters.jsp
Jdbcconnections cannot be resolved to a type
11: <%@ page import="Jdbcconnections" %>
12: <%
13:
14: Jdbcconnections obj=new Jdbcconnections();
15: Connection con;
16: con=obj.connect();
17:


An error occurred at line: 14 in the jsp file: /payroll/ddoregisters.jsp
Jdbcconnections cannot be resolved to a type
11: <%@ page import="Jdbcconnections" %>
12: <%
13:
14: Jdbcconnections obj=new Jdbcconnections();
15: Connection con;
16: con=obj.connect();
17:



thnx in advance
 
Greenhorn
Posts: 21
Mac Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should never perform database operations directly in the JSP. All the DB connection and query stuff needs to be moved to lower level of application: servlet or the special Data Access Object.

As far as the connection problems themselves, the question is probably more appropriate in the JDBC forum
 
Sheriff
Posts: 67746
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
As this has nothing to do with JSP, and the code shouldn't even be in the JSP as noted, this has been moved to the JDBC forum.
 
ankur mawandia
Greenhorn
Posts: 12
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can some one tell me please why my connection class can not be resolved
 
Bear Bibeault
Sheriff
Posts: 67746
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
  • Move the code out of a JSP and into a Java class.
  • Place all Java classes in a package other than the default.
  • Maker sure your class files are placed in the correct folder under WEB-INF.
  •  
    ankur mawandia
    Greenhorn
    Posts: 12
    Eclipse IDE Postgres Database Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i have created a folder connect in my WEB-INF directory and placed my java and class files there

    and
    <%@ page import="connect.Jdbcconnections" %>

    is this correct
     
    Bear Bibeault
    Sheriff
    Posts: 67746
    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
    No, the code is still in a JSP.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic