1 12 13 package org.ejtools.jmx.browser.web.action; 14 15 16 17 import java.io.IOException ; 18 19 import java.util.Locale ; 20 21 import java.util.Vector ; 22 23 24 25 import javax.servlet.ServletContext ; 26 27 import javax.servlet.ServletException ; 28 29 import javax.servlet.http.HttpServletRequest ; 30 31 import javax.servlet.http.HttpServletResponse ; 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 70 71 public class ClearSearchAction extends Action 72 73 { 74 75 76 77 public ClearSearchAction() { } 78 79 80 81 82 83 104 105 public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 106 107 throws IOException , ServletException 108 109 { 110 111 113 Locale locale = getLocale(request); 114 115 MessageResources messages = getResources(); 116 117 118 119 121 ActionErrors errors = new ActionErrors(); 122 123 124 125 ServletContext 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 result = new Vector (); 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 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 |