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;
}
}