Package actions

Source Code of actions.LogoutAction

package actions;

import interfaces.exceptions.MetierException;

import java.util.ArrayList;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import base.Client;
import base.Produit;


import ressources.Message;
import ressources.Panier;

public class LogoutAction implements Action {
 


    private String suite,erreur;
   
    public LogoutAction(String suite,String erreur){
      this.suite = suite;
      this.erreur = erreur;
    }
   
    /**
     *
     */
    public String execute(HttpServletRequest req) throws Exception {
      /* On invalide la session */
      HttpSession session = req.getSession();
      req.setAttribute(Message.TITRE_MESSAGE,Message.TITRE_DECO);
      req.setAttribute(Message.MESSAGE, Message.DECO);
      if(session != null){   
        Client client = (Client)session.getAttribute("client");
        if(client != null){
          session.invalidate();
        }else{
          return erreur;
        }
      }
     
      return suite;
    }
   

}
TOP

Related Classes of actions.LogoutAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.