KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > contineo > actions > search > ExtendedSearchAction


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

6
7 package org.contineo.actions.search;
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.forms.SearchForm;
14 /**
15  *
16  * @author Michael Scholz
17  * @version 1.0
18  */

19 public class ExtendedSearchAction extends Action {
20
21     private Logger logger;
22
23     /** Creates a new instance of StrutsAction */
24     public ExtendedSearchAction() {
25         logger = LoggingManager.getLogger(this.getClass());
26     }
27
28     public ActionForward execute(ActionMapping mapping,
29                     ActionForm form, HttpServletRequest request,
30                     HttpServletResponse response) {
31         ActionForward actionForward = new ActionForward();
32         HttpSession session = request.getSession();
33         if (SessionManagement.isValid(session)) {
34             SearchForm searchForm = new SearchForm();
35             try {
36                 searchForm.setFormat("all");
37                 searchForm.setEnglish(true);
38                 searchForm.setFrench(true);
39                 searchForm.setGerman(true);
40                 searchForm.setContent(true);
41                 searchForm.setKeywords(true);
42             } catch (Exception JavaDoc e) {
43                 if (logger.isEnabledFor(Level.ERROR))
44                     logger.error(e.getMessage());
45             }
46             request.setAttribute("searchForm", searchForm);
47             actionForward = mapping.findForward("extendedsearch");
48         } else
49             actionForward = mapping.findForward("invalid");
50         return actionForward;
51     }
52 }
Popular Tags