01: /*
02: * Created on 3 mai 2004
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07:
08: package mc.formgenerator.servlets.bonita;
09:
10: import java.io.IOException;
11:
12: import javax.servlet.http.*;
13:
14: /**
15: * It is the servlet which allows the posting of the projects modeles to display.
16: * It asks to the Modele class to obtain information,
17: * and redirects the result on the JSP page so that posting is not with the treatment.
18: */
19: public class ServletAccueil extends HttpServlet {
20:
21: /**
22: * @throws IOException
23: */
24: public void doGet(HttpServletRequest req, HttpServletResponse res)
25: throws IOException {
26:
27: //Create the modele corresponding to this controller
28: ModeleAccueil accueil = new ModeleAccueil();
29:
30: //Get the session of the user.
31: HttpSession session = req.getSession(true);
32:
33: //Save in the session the modele which has the information to display.
34: session.setAttribute("modeleAccueil", accueil);
35:
36: try {
37: //Asks to the modele to do its work.
38: accueil.process();
39:
40: String url = new String(req.getRequestURL());
41:
42: //The request is redirected on the JSP page so that it builds the answer for the user.
43: this .getServletContext().getRequestDispatcher(
44: "/web/jsp/accueil.jsp").forward(req, res);
45:
46: } catch (Exception e) {
47: e.printStackTrace();
48: res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
49: e.getMessage());
50: }
51: }
52:
53: }
|