FileDocCategorySizeDatePackage
LoginBean.javaAPI DocExample1112Wed Aug 06 14:36:26 BST 2003com.jspservletcookbook

LoginBean

public class LoginBean extends Object

Fields Summary
private ServletRequest
req
boolean
loginSuccess
Constructors Summary
public LoginBean()

 
Methods Summary
public booleangetLoginSuccess()

    
      if (req == null)
          throw new IllegalStateException(
          "The ServletRequest cannot be null in getLogin()");
          
      WebCallbackHandler webcallback = new WebCallbackHandler(req);
      
     try{
    
          LoginContext lcontext = new LoginContext("WebLogin",webcallback );
          
          lcontext.login();
          
          return true;
    
      } catch (LoginException lge){
    
         return false;
    
      }

   
public voidsetReq(javax.servlet.ServletRequest request)

       
         if (request == null)
             throw new IllegalArgumentException(
               "ServletRequest argument was null in: "+getClass().getName());
			   
		 this.req = request;