import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.util.*; /** * @version 1.0 * @author */ public class ServletJdbcMVC2 extends HttpServlet { /** * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { TraitementPays tPays = new TraitementPays(); ListePays lPays = tPays.getListe(); req.setAttribute("PAYS",lPays); getServletContext().getRequestDispatcher("/JdbcMVC.jsp").forward(req,resp); } catch (Exception e) { resp.sendError(500 , "Erreur lors de l'accès à la base" + e); } } /** * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } } |