1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
package fr.iga.ivioto.servlet;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionServlet;
public class MyServlet extends ActionServlet{
/**
*
*/
public MyServlet()
{
}
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{
System.out.println("============doGet");
try{
super.doGet(request,response);
}
catch(Exception e)
{
System.out.println("============MyExceptiondoGet");
request.setAttribute("error", e);
request.getRequestDispatcher ("/WEB-INF/pages/util_erreur.jsp").forward(request,response);
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException
{
try{
super.doPost(request,response);
System.out.println("============doPost");
}
catch(Exception e)
{
System.out.println("============MyExceptiondoPost");
request.setAttribute("error", e);
response.sendRedirect("/WEB-INF/pages/util_erreur.jsp");
doGet(request,response);
}
}
public void init() throws ServletException
{
super.init();
}
} |
Partager