| 1 6 7 package org.contineo.actions.config; 8 9 import javax.servlet.http.*; 10 import org.apache.struts.action.*; 11 import org.apache.log4j.*; 12 import org.contineo.core.*; 13 import org.contineo.core.config.SearchSettings; 14 import org.contineo.core.config.dao.SearchSettingsDAO; 15 20 public class ShowSearchSettingsAction extends Action { 21 22 private Logger logger; 23 24 25 public ShowSearchSettingsAction() { 26 logger = LoggingManager.getLogger(this.getClass()); 27 } 28 29 public ActionForward execute(ActionMapping mapping, 30 ActionForm form, HttpServletRequest request, 31 HttpServletResponse response) { 32 ActionForward actionForward = new ActionForward(); 33 HttpSession session = request.getSession(); 34 if (SessionManagement.isValid(session)) { 35 try { 36 String username = (String )session.getAttribute("authuser"); 37 SearchSettingsDAO settingsDao = new SearchSettingsDAO(); 38 SearchSettings settings = settingsDao.findByPrimaryKey(username); 39 request.setAttribute("settings", settings); 40 actionForward = mapping.findForward("showsearchsettings"); 41 } catch (Exception e) { 42 if (logger.isEnabledFor(Level.ERROR)) 43 logger.error(e.getMessage()); 44 actionForward = mapping.findForward("error"); 45 } 46 } else 47 actionForward = mapping.findForward("invalid"); 48 return actionForward; 49 } 50 } | Popular Tags |