package controleur;
import Metier.StructureBibliotheque;
import Metier.StructureBibliothequeService;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SuppressionStructure extends HttpServlet {
public static final String VUE_ARMOIRE = "/privateAcces/Armoire.jsp";
private static final String PARAM_ID = "id";
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int id = Integer.parseInt(request.getParameter(this.PARAM_ID));
StructureBibliothequeService structureBibliothequeService = Metier.MetierFactory.getStructureService();
StructureBibliotheque structureBibliotheque = structureBibliothequeService.getById(id);
structureBibliothequeService.remove(structureBibliotheque);
this.getServletContext().getRequestDispatcher(this.VUE_ARMOIRE).forward( request, response );
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}