Results 1 to 2 of 2
  1. #1
    aarshi is offline Member
    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Default need help ..login mvc architecture control nt going to nested if after checking null

    public class Login_bo {

    public String validate(HttpServletRequest request,HttpServletResponse response)
    {
    System.out.println("in BO");
    String flag="Fail";
    Set<LoginBean> hs=new HashSet<LoginBean>();

    String userName=request.getParameter("uname");
    String password=request.getParameter("pass");
    String usertype=request.getParameter("usertype");
    System.out.println("userType:"+usertype);

    LoginBean objOfLoginBean=new LoginBean();
    objOfLoginBean.setUname(userName);
    objOfLoginBean.setPass(password);
    objOfLoginBean.setUsertype(usertype);

    Login_dao objOfLoginDAO=new Login_dao();
    hs=(Set<LoginBean>)objOfLoginDAO.userCridential((o bjOfLoginBean));

    Iterator<LoginBean> itr=hs.iterator();
    String tempUserName=null;
    String tempPassword=null;
    String tempUsertype=null;
    LoginBean obj=new LoginBean();
    while(itr.hasNext())
    {
    obj=itr.next();

    }
    tempUserName=obj.getUname();
    tempPassword=obj.getPass();
    tempUsertype=obj.getUsertype();
    System.out.println("after getting userType:"+objOfLoginBean.getUsertype());
    if(tempUserName!=null&& tempPassword!=null)
    {

    if((tempUserName.equals(objOfLoginBean.getUname()) )&&(tempPassword.equals(objOfLoginBean.getPass())) &&(tempUsertype.equals(objOfLoginBean.getUsertype( ))))
    {
    System.out.println("in 1st");

    HttpSession session=request.getSession(true);
    session.setAttribute("userDetail",objOfLoginBean );

    System.out.println("Match successfull");
    if(objOfLoginBean.getUsertype().equals("JobSeeker" ))
    {
    System.out.println("Jobseeker succes");
    flag="JobSeekerLoginSuccess";
    }
    else if(objOfLoginBean.getUsertype().equals("Employer") )
    {
    System.out.println("Employer success");
    flag="EmployeeLoginSuccess";
    }

    }
    }
    else
    {
    flag="Fail";
    }


    return flag;


    }

    }

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: need help ..login mvc architecture control nt going to nested if after checking n

    Format your code properly, post it with code tags, and ask a question...
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 1
    Last Post: 05-08-2013, 08:19 PM
  2. Replies: 6
    Last Post: 10-22-2012, 03:12 PM
  3. null pointer exception with nested ? : syntax
    By jamesd128 in forum New To Java
    Replies: 6
    Last Post: 03-05-2012, 12:14 PM
  4. Replies: 1
    Last Post: 10-22-2011, 06:50 AM
  5. Replies: 0
    Last Post: 10-02-2010, 10:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •