KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > action > security > ListUsersAction


1 package org.nextime.ion.backoffice.action.security;
2
3 import java.io.IOException JavaDoc;
4 import java.util.Collections JavaDoc;
5 import java.util.Vector JavaDoc;
6
7 import javax.servlet.ServletException JavaDoc;
8 import javax.servlet.http.HttpServletRequest JavaDoc;
9 import javax.servlet.http.HttpServletResponse JavaDoc;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 import org.nextime.ion.backoffice.action.BaseAction;
14 import org.nextime.ion.framework.business.User;
15 import org.nextime.ion.framework.mapping.Mapping;
16
17 public class ListUsersAction extends BaseAction {
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         // check if user is correctly logged
27
checkUser(request);
28
29         // fill data
30
try {
31             Mapping.begin();
32
33             Vector JavaDoc users = User.listAll();
34             Collections.sort(users);
35             Collections.reverse(users);
36             request.setAttribute("users",users);
37             
38             Mapping.rollback();
39
40         } catch (Exception JavaDoc e) {
41             Mapping.rollback();
42             throw new ServletException JavaDoc(e);
43         }
44
45         // Forward to the next page
46
return (mapping.findForward("view"));
47
48     }
49
50 }
51
Popular Tags