KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > web > action > ClearSearchAction


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.web.action;
14
15
16
17 import java.io.IOException JavaDoc;
18
19 import java.util.Locale JavaDoc;
20
21 import java.util.Vector JavaDoc;
22
23
24
25 import javax.servlet.ServletContext JavaDoc;
26
27 import javax.servlet.ServletException JavaDoc;
28
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30
31 import javax.servlet.http.HttpServletResponse JavaDoc;
32
33
34
35 import org.apache.struts.action.Action;
36
37 import org.apache.struts.action.ActionError;
38
39 import org.apache.struts.action.ActionErrors;
40
41 import org.apache.struts.action.ActionForm;
42
43 import org.apache.struts.action.ActionForward;
44
45 import org.apache.struts.action.ActionMapping;
46
47 import org.apache.struts.util.MessageResources;
48
49 import org.ejtools.jmx.browser.web.Constants;
50
51 import org.ejtools.jmx.browser.web.JMXContainer;
52
53
54
55 /**
56
57  * Description of the Class
58
59  *
60
61  * @author letiemble
62
63  * @created 12 novembre 2001
64
65  * @version $Revision: 1.6 $
66
67  * @todo Javadoc to complete
68
69  */

70
71 public class ClearSearchAction extends Action
72
73 {
74
75    /** Constructor for the FilterAction object */
76
77    public ClearSearchAction() { }
78
79
80
81
82
83    /**
84
85     * Description of the Method
86
87     *
88
89     * @param mapping Description of the Parameter
90
91     * @param form Description of the Parameter
92
93     * @param request Description of the Parameter
94
95     * @param response Description of the Parameter
96
97     * @return Description of the Return Value
98
99     * @exception IOException Description of the Exception
100
101     * @exception ServletException Description of the Exception
102
103     */

104
105    public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
106
107       throws IOException JavaDoc, ServletException JavaDoc
108
109    {
110
111       // Extract attributes we will need
112

113       Locale JavaDoc locale = getLocale(request);
114
115       MessageResources messages = getResources();
116
117
118
119       // Validate the request parameters specified by the user
120

121       ActionErrors errors = new ActionErrors();
122
123
124
125       ServletContext JavaDoc context = this.getServlet().getServletContext();
126
127       JMXContainer tree = (JMXContainer) context.getAttribute(Constants.TREE);
128
129
130
131       if (tree != null)
132
133       {
134
135          Vector JavaDoc result = new Vector JavaDoc();
136
137          context.setAttribute(Constants.SEARCH_RESULT, result);
138
139       }
140
141       else
142
143       {
144
145          errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("web.error.cannot.connect"));
146
147       }
148
149
150
151       // Report any errors we have discovered back to the original form
152

153       if (!errors.empty())
154
155       {
156
157          saveErrors(request, errors);
158
159          return (mapping.findForward("error"));
160
161       }
162
163
164
165       return (mapping.findForward("view"));
166
167    }
168
169 }
170
171
Popular Tags