Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/ahlner/Log4J2DB/web/actions/SearchAction.java


1   /* $Id: SearchAction.java,v 1.5 2003/07/05 17:08:38 phah Exp $
2    * Project: log4j2db-web.
3    * 
4    * This Software is published under General Public License.
5    * See terms of licence at gnu.org
6    */
7   
8   
9   package org.ahlner.Log4J2DB.web.actions;
10  
11  
12  import java.text.DateFormat;
13  import java.util.Collection;
14  
15  import javax.servlet.http.HttpServletRequest;
16  import javax.servlet.http.HttpServletResponse;
17  
18  import org.ahlner.Log4J2DB.web.beans.Log4JEvent;
19  import org.ahlner.Log4J2DB.web.forms.SearchForm;
20  import org.apache.struts.action.Action;
21  import org.apache.struts.action.ActionForm;
22  import org.apache.struts.action.ActionForward;
23  import org.apache.struts.action.ActionMapping;
24  
25  /**
26   * @author philipp
27   * @struts.action path="/Search" name="SearchForm" scope="request" input="/index.jsp"
28   * @struts.action-forward name="Search" path="/index.jsp"
29   */
30  public class SearchAction extends Action
31  {
32  /* (non-Javadoc)
33   * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
34   */
35  public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse res)
36      throws Exception
37  {
38    Collection ret = (Collection) req.getSession().getAttribute("retEvents");
39  
40    Log4JEvent evt = (Log4JEvent) req.getSession().getAttribute("event");
41    
42    evt.setHosts(((SearchForm)form).getHosts());
43    evt.setPriorities(((SearchForm)form).getPriorities());
44    evt.setFromTime( new Float((DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, req.getLocale()).parse(((SearchForm)form).getFromTime()).getTime())));
45    evt.setToTime( new Float((DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, req.getLocale()).parse(((SearchForm)form).getToTime()).getTime())));
46    evt.setLoggers(((SearchForm)form).getLoggers());
47      ret = evt.searchEvents();
48    req.getSession().setAttribute("retEvents", ret); 
49    return map.findForward("Search");
50  }
51    
52  }
53  /*
54   * $Log: SearchAction.java,v $
55   * Revision 1.5  2003/07/05 17:08:38  phah
56   * updated to struts 1.1
57   *
58   * Revision 1.4  2003/05/04 16:45:48  phah
59   * getEvents renamed by searchEvents
60   *
61   * Revision 1.3  2003/05/04 16:35:55  phah
62   * validation improved
63   *
64   * Revision 1.2  2003/05/03 18:19:02  phah
65   * forward target corrected
66   *
67   * Revision 1.1  2003/05/03 18:08:03  phah
68   * struts implementation
69   *
70   */