• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Servlet Login

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a beginner JSP/Servlet writer and I'm having a problem which is probably simple.

I am trying to create a jsp that uses a servlet to connect to a database and display, if they user is a member, it displays information and if not, it sends them back to the login page.

I am using two java files to do this, one is a servlet (Controller.java) that controls the information between the jsp and the second file (DBConn.java), which connects to the DB and creates an object which has the user info in it, and then returns it to the servlet.

DBConn compiles but Controller does not see the class DBConn. Here is the code for Controller.java



The DBConn source is:


Any ideas?

Thanks
 
Robert Saxxon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
btw, the error im getting is:

Controller.java:9: cannot resolve symbol
symbol : class DBConn
location: class shamik.Controller
public DBConn UData = new DBConn();
^
Controller.java:9: cannot resolve symbol
symbol : class DBConn
location: class shamik.Controller
public DBConn UData = new DBConn();
^
2 errors
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai

guess ur using command line compilation, just try
java -classpath <DIR> Controller.java

where DIR is the path till the dir where the DBConn.class is located

bye

Surya
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Controller.java:9: cannot resolve symbol
symbol : class DBConn
location: class shamik.Controller
public DBConn UData = new DBConn();



As you can see it is showing location: class shamik.Controller. You have define the Controller class in shamik package and you are accessing class DBConn which is in sdez package

So use import sdez at the top in definition of Controller class
 
Don't MAKE me come back there with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic