KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mc > formgenerator > servlets > bonita > ServletWorkList


1 /*
2  * Created on September 2004, the 16th
3  * By the Message Center Team
4  */

5 package mc.formgenerator.servlets.bonita;
6
7 import java.io.File JavaDoc;
8 import java.io.IOException JavaDoc;
9
10 import javax.servlet.http.*;
11
12 /**
13  * Servlet as controller for worklist.jsp
14  * @author SEMPERE benjamin
15  *
16  */

17 public class ServletWorkList extends HttpServlet {
18
19
20
21
22     /**
23      * Get request
24      * @throws IOException
25      */

26     public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException JavaDoc {
27         
28         //Create the model corresponding to this controller
29
ModelWorkList modelWorkList = new ModelWorkList();
30         
31         //Create the repository facade corresponding to this controller
32
//System.out.println("REPOSITORY FACADE FILE: " + getServletConfig().getServletContext().getRealPath("") + File.separator + "web" + File.separator+ "repository.xml");
33
RepositoryFacade repositoryFacade = new RepositoryFacade(getServletConfig().getServletContext().getRealPath("") + File.separator + "web" + File.separator+ "repository.xml");
34         
35         //Get the session of the user.
36
HttpSession session = req.getSession(true);
37
38         //Save in the session the model which has the information to display.
39
session.setAttribute("modelWorkList", modelWorkList);
40         
41         //Save in the session the repository facade.
42
session.setAttribute("repositoryFacade",repositoryFacade);
43         
44         try{
45             //Asks to the model to do its work
46
modelWorkList.process();
47             
48             //The request is redirected on the JSP page so that it builds the answer for the user.
49
this.getServletContext().getRequestDispatcher("/web/jsp/worklist.jsp").forward(req,res);
50
51         }
52         catch(Exception JavaDoc e){
53             e.printStackTrace();
54             res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
55         }
56     }
57 }
58
Popular Tags