日期:2014-05-20  浏览次数:20751 次

我的编译出问题
import   java.io.*;
import   java.sql.*;
import   javax.servlet.*;
import   javax.servlet.http.*;
import   bean.UserInf;
import   bean.DBClass;
import   bean.StrClass;

public   class   AdminLogin   extends   HttpServlet{
public   void   doGet(HttpServletRequest   request,   HttpServletResponse   response)  
throws   ServletException,   IOException   {
HttpSession   session=request.getSession();
String   toJsp= " ";
String   id=request.getParameter( "id ");
String   pwd=request.getParameter( "password ");
String   query= "SELECT   *   FROM   admin   WHERE   id= "+ "\ ' "+   id   +   "\ ' "
+ "AND   password= "+ "\ ' "+   pwd   +   "\ ' ";
DBClass   db=new   DBClass();
db.connect();
ResultSet   resultset=db.executeQuery(query);
try{
if(resultset.next()){
session.setAttribute( "adminId ",   id);    
toJsp= "/adminLoginSuccess.jsp ";
}   else   {
toJsp= "/adminLogin.jsp ";
request.setAttribute( "errInf ", "*密码与帐号不匹配 ");
}
}catch(SQLException   sqle){
      System.err.println( "Erro   with   connection: "+sqle);
}
db.closeConnection();

RequestDispatcher   dispatcher   =  
                                    request.getRequestDispatcher(toJsp);                        
dispatcher.forward(request,   response);
}

public   void   doPost(HttpServletRequest   request,   HttpServletResponse   response)
throws   ServletException,   IOException   {
doGet(request,response);
}
}


这是原程序,在别人的机子上可以运行成功
可是不知道我的是什么问题
  总是出现
cannot   find   symbol   method   setAttribute()。。。。
我已经将servlet的包放到相应的文件中了

------解决方案--------------------
我用import bean.UserInf;的候怎么说"软件包 bean 不存在" LZ怎么可以啊?