KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > communicator > admin > controller > DisplayAccountManagementAction


1 /*
2  * DisplayAccountManagementAction.java
3  *
4  * Created on May 3, 2003, 8:05 AM
5  */

6
7 package com.quikj.application.communicator.admin.controller;
8
9 import com.quikj.application.communicator.admin.model.*;
10
11 import javax.servlet.http.*;
12 import org.apache.struts.action.*;
13
14 import java.sql.*;
15
16 /**
17  *
18  * @author bhm
19  */

20 public class DisplayAccountManagementAction extends Action
21 {
22     
23     /** Creates a new instance of DisplayAccountManagementAction */
24     public DisplayAccountManagementAction()
25     {
26     }
27     
28     public ActionForward execute(ActionMapping mapping,
29     ActionForm form,
30     HttpServletRequest request,
31     HttpServletResponse response)
32     {
33         ActionErrors errors = new ActionErrors();
34         
35         Connection c = (Connection)request.getSession().getAttribute("connection");
36         if (c == null)
37         {
38             errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.not.logged.in"));
39             saveErrors(request, errors);
40             
41             return mapping.findForward("logon");
42         }
43         
44         AccountElement element = (AccountElement)request.getSession().getAttribute("userInfo");
45         if (element.isAdminLevel() == false)
46         {
47             errors.add(ActionErrors.GLOBAL_ERROR,
48             new ActionError("error.insufficient.privilege"));
49             saveErrors(request, errors);
50             
51             return mapping.findForward("main_menu");
52         }
53         
54         // add related tasks to the navigation bar
55

56         
57         return mapping.getInputForward();
58     }
59 }
60
Popular Tags