日期:2014-05-18  浏览次数:20765 次

根据不同权限登录不同页面,大家帮看看哪里有问题!!!
protected   void   doPost(HttpServletRequest   request,   HttpServletResponse   response)  
throws   ServletException,   IOException
  {
            HttpSession     session   =request.getSession();
            boolean   value   =   false;
            String   c_id   =   request.getParameter( "c_id ");        
            String   c_pwd   =   request.getParameter( "c_pass ");
            LoginBean   logind   =   new   LoginBean();
            if   (logind.checkUser(c_id,c_pwd))
            {      
if(logind.RootSelect(c_id)&&value   ==   true)
{
      session.setAttribute( "c_id ",c_id);
      response.sendRedirect( "root_main.jsp ");
      session.setAttribute( "isLogin ", "true ");
}   else
                  if(logind.UsrSelect(c_id)&&value   ==   true)
{
    session.setAttribute( "c_id ",c_id);
    response.sendRedirect( "usr_main.jsp ");
    session.setAttribute( "isLogin ", "true ");
}   else
if(logind.SupplySelect(c_id)&&value   ==   true)
{
    session.setAttribute( "c_id ",c_id);
    response.sendRedirect( "supply_main.jsp ");
    session.setAttribute( "isLogin ", "true ");
}}  
          else  
        {
      session.setAttribute( "errorMessage ", "the   account   "   +   c_id   +   ",   or   secret   "   +   c_pwd   +   "is   wrong ");
      response.sendRedirect( "error.jsp ");
          } }
我写了一个根据不同权限登录不同页面的Servlet,我也看不出哪里有问题,但是就是通不过去

------解决方案--------------------
Session session = request.getServletConext().getSession();
------解决方案--------------------
value 你的value永远都是false.....
看看是不是少了一点点

value=....什么的
------解决方案--------------------
唯一性约束?