KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > communicator > applications > webtalk > controller > DisplayRegReportInputAction


1 package com.quikj.application.communicator.applications.webtalk.controller;
2
3 import java.io.IOException JavaDoc;
4 import java.util.Locale JavaDoc;
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8 import org.apache.struts.action.Action;
9 import org.apache.struts.action.ActionError;
10 import org.apache.struts.action.ActionErrors;
11 import org.apache.struts.action.ActionForm;
12 import org.apache.struts.action.ActionForward;
13 import org.apache.struts.action.ActionMapping;
14 import com.quikj.application.communicator.admin.controller.*;
15 import java.sql.*;
16
17 /**
18  * Implementation of <strong>Action</strong> that validates a user logon.
19  * Based on Apache Struts framework.
20  *
21  * @author Vinod Batra
22  * @version $Revision: 1.7 $ $Date: 2004/10/10 18:03:43 $
23  */

24
25 public final class DisplayRegReportInputAction extends Action
26 {
27     /**
28      * Process the specified HTTP request, and create the corresponding HTTP
29      * response (or forward to another web component that will create it).
30      * Return an <code>ActionForward</code> instance describing where and how
31      * control should be forwarded, or <code>null</code> if the response has
32      * already been completed.
33      *
34      * @param mapping The ActionMapping used to select this instance
35      * @param actionForm The optional ActionForm bean for this request (if any)
36      * @param request The HTTP request we are processing
37      * @param response The HTTP response we are creating
38      *
39      * @exception IOException if an input/output error occurs
40      * @exception ServletException if a servlet exception occurs
41      */

42     public ActionForward execute(ActionMapping mapping,
43     ActionForm form,
44     HttpServletRequest JavaDoc request,
45     HttpServletResponse JavaDoc response)
46     throws IOException JavaDoc, ServletException JavaDoc
47     {
48         // Extract attributes we will need
49
Locale JavaDoc locale = getLocale(request);
50         ActionErrors errors = new ActionErrors();
51         
52         // first check if the user has a connection
53
Connection c = (Connection)request.getSession().getAttribute("connection");
54         if (c == null)
55         {
56             errors.add(ActionErrors.GLOBAL_ERROR,
57             new ActionError("error.not.logged.in"));
58             saveErrors(request, errors);
59             return mapping.findForward("logon");
60         }
61         
62         WebTalkRelatedTasks menu = new WebTalkRelatedTasks();
63         menu.addLink(new LinkAttribute("Visitor Report", "visitor_report_input"));
64         menu.addLink(new LinkAttribute("Usage Report", "traffic_report_input"));
65         
66         request.setAttribute("menu", menu);
67         return (new ActionForward(mapping.getInput()));
68     }
69 }
70
Popular Tags