My directory structure looks like this:
Directory of C:\SITEMI~1\WEB-INF\classes\CCT
06/17/2002 08:54a <DIR> .
06/17/2002 08:54a <DIR> ..
06/17/2002 08:52a 3,145 Admin.java
06/14/2002 01:58p 2,862 AdminCheck.clas
06/14/2002 01:58p 2,699 AdminCheck.java
06/14/2002 02:58p 743 Calendar.java
06/14/2002 03:25p 289 Counter.class
06/14/2002 03:25p 120 Counter.java
and Admin.java and AdminCheck.java each have
package CCT;
at the top.
Why does the following occur?
C:\SITEMI~1\WEB-INF\classes\CCT>javac Admin.java
Admin.java:27: cannot resolve symbol
symbol : class AdminCheck
location: class CCT.Admin
private static final AdminCheck ct = new AdminCheck();
^
Admin.java:27: cannot resolve symbol
symbol : class AdminCheck
location: class CCT.Admin
private static final AdminCheck ct = new AdminCheck();
Admin.java
leo
------------
Leo Mendoza
lmendoza-at-garbersoft-dot-net
Directory of C:\SITEMI~1\WEB-INF\classes\CCT
06/17/2002 08:54a <DIR> .
06/17/2002 08:54a <DIR> ..
06/17/2002 08:52a 3,145 Admin.java
06/14/2002 01:58p 2,862 AdminCheck.clas
06/14/2002 01:58p 2,699 AdminCheck.java
06/14/2002 02:58p 743 Calendar.java
06/14/2002 03:25p 289 Counter.class
06/14/2002 03:25p 120 Counter.java
and Admin.java and AdminCheck.java each have
package CCT;
at the top.
Why does the following occur?
C:\SITEMI~1\WEB-INF\classes\CCT>javac Admin.java
Admin.java:27: cannot resolve symbol
symbol : class AdminCheck
location: class CCT.Admin
private static final AdminCheck ct = new AdminCheck();
^
Admin.java:27: cannot resolve symbol
symbol : class AdminCheck
location: class CCT.Admin
private static final AdminCheck ct = new AdminCheck();
Admin.java
Code:
package CCT; //for neatness sake
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class Admin extends HttpServlet {
private Connection c = null;
private Statement s = null;
//should work, since AdminCheck is in the same package
private static final AdminCheck ct = new AdminCheck();
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("Authenticating user...<br />");
//first we authenticate the session against what's in the DB
HttpSession sess = req.getSession();
if(sess.getAttribute("login.userName") != null) { //1st layer of verification
out.println("UNAUTHORIZED USER");
return;
} //end if
String sql = "SELECT userid FROM CCT_AuthUsers WHERE UserLogin = '" +
sess.getAttribute("login.userName") + "' AND sid = '" + sess.getId() + "'";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c = DriverManager.getConnection(
"jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Site Mirror/test.mdb",
"","");
s = c.createStatement();
ResultSet rs = s.executeQuery(sql);
if(!rs.next()) {
out.println("UNAUTHORIZED USER");
return;
} //end if
//once we get here, we're validated and authorized
int atype = Integer.parseInt(req.getParameter("atype"));
out.println("running!");
} catch (ClassNotFoundException e) {
out.println("Class not found!\n" + e.getMessage() + "\n" + e.toString());
} catch (SQLException e) {
out.println("SQL Error occurred!\n" + e.getMessage() + "\n" + e.toString());
} finally {
try {
if(c != null) c.close();
} catch (Throwable t) {
out.println("Could not close connection");
} //end try
} //end try
} //end doPost
/**
* Necessary wrapper. Calls doPost
**/
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req,res);
} //end doGet
private final void outputPage() {
} //end outputPage
} //end Admin
------------
Leo Mendoza
lmendoza-at-garbersoft-dot-net