KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > contineo > actions > config > ShowSearchSettingsAction


1 /*
2  * StrutsAction.java
3  *
4  * Created on 16. Dezember 2003, 22:25
5  */

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 /**
16  *
17  * @author Michael Scholz
18  * @version 1.0
19  */

20 public class ShowSearchSettingsAction extends Action {
21
22     private Logger logger;
23
24     /** Creates a new instance of StrutsAction */
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 JavaDoc username = (String JavaDoc)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 JavaDoc 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