} else { return new ForwardParameters(mapping.findForward("template")) .addParameter("name", template.getName()).forward(); }
   public ActionForward execute(ActionMapping mapping,                                ActionForm form,                                HttpServletRequest request,                                HttpServletResponse response)       throws Exception {       HttpSession session = request.getSession();       PathQuery query = (PathQuery) session.getAttribute(Constants.QUERY);       boolean showTemplate = (request.getParameter("showTemplate") != null);       if (query == null) {           SessionMethods.setHasQueryCookie(session, response, false);           return new ForwardParameters(getWebProperties(request)                   .getProperty("project.sitePrefix"), true).forward();       }        if (query instanceof TemplateQuery && showTemplate) {            TemplateQuery template = (TemplateQuery) query;            if (template.isEdited()) {                Profile profile = (Profile) session.getAttribute(Constants.PROFILE);                SavedQuery sq = null;                for (Iterator iter = profile.getHistory().values().iterator(); iter.hasNext();) {                    sq = (SavedQuery) iter.next();                    if (sq.getPathQuery().equals(template)) {                        break;                    }                }                return new ForwardParameters(mapping.findForward("template"))                    .addParameter("loadModifiedTemplate",                              "true")                    .addParameter("name", sq.getName())                              .forward();            } else {                return new ForwardParameters(mapping.findForward("template"))                    .addParameter("name", template.getName()).forward();            }        } else {            return mapping.findForward("query");        }    }