• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Login

 
Robert Saxxon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
N S Raju
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic