KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > admin > action > user > ListUserAction


1 package org.nextime.ion.admin.action.user;
2
3 import java.io.IOException JavaDoc;
4 import java.util.Vector JavaDoc;
5
6 import javax.servlet.ServletException JavaDoc;
7 import javax.servlet.http.HttpServletRequest JavaDoc;
8 import javax.servlet.http.HttpServletResponse JavaDoc;
9 import org.apache.struts.action.Action;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13
14 import org.nextime.ion.framework.business.User;
15 import org.nextime.ion.framework.mapping.Mapping;
16
17 public class ListUserAction extends Action {
18
19     public ActionForward perform(
20         ActionMapping mapping,
21         ActionForm form,
22         HttpServletRequest JavaDoc request,
23         HttpServletResponse JavaDoc response)
24         throws IOException JavaDoc, ServletException JavaDoc {
25
26         // pour situer la vue
27
request.setAttribute("view", "user");
28
29         try {
30             Mapping.begin();
31             Vector JavaDoc v = User.listAll();
32             Mapping.commit();
33             request.setAttribute("users", v);
34         } catch (Exception JavaDoc e) {
35             Mapping.rollback();
36             throw new ServletException JavaDoc(e);
37         }
38
39         return mapping.findForward("view");
40     }
41
42 }
Popular Tags