KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > modules > searcher > PubSearchAction


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.modules.searcher;
7
8 import java.util.*;
9
10 import javax.servlet.http.HttpServletRequest JavaDoc;
11
12 import com.raptus.owxv3.*;
13 import com.raptus.owxv3.api.VModuleRoleAction;
14
15 /**
16  *
17  * <hr>
18  * <table width="100%" border="0">
19  * <tr>
20  * <td width="24%"><b>Filename</b></td><td width="76%">PubSearchAction.java</td>
21  * </tr>
22  * <tr>
23  * <td width="24%"><b>Author</b></td><td width="76%">REEA</td>
24  * </tr>
25  * <tr>
26  * <td width="24%"><b>Date</b></td><td width="76%">12th of October 2001</td>
27  * </tr>
28  * </table>
29  * <hr>
30  * <table width="100%" border="0">
31  * <tr>
32  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
33  * </tr>
34  * </table>
35  * <hr>
36  *This Action is called search and display the search results.
37  */

38 //public class PubSearchAction extends VModuleAnonAction
39
public class PubSearchAction extends VModuleRoleAction
40 {
41
42     /**
43      *
44      */

45     protected String JavaDoc dispatchVModuleElement(HttpServletRequest JavaDoc request,
46                                             String JavaDoc element,
47                                             org.apache.struts.action.ActionForm form,
48                                             VModule vm,
49                                             Locale locale)
50     {
51
52         SearchBean sb=(SearchBean) form;
53         sb.setCurrLocale(locale);
54         String JavaDoc pageNo=request.getParameter("page");
55         if(pageNo!=null)
56         {
57             int pn=1;
58             try
59             {
60                 pn=Integer.parseInt(pageNo);
61             }catch(NumberFormatException JavaDoc e){}
62             sb.setCurrentPage(pn);
63         }
64         else
65         {
66             String JavaDoc input=null;
67             sb.clearSearchInput();
68             for(Enumeration e=request.getParameterNames();e.hasMoreElements();)
69             {
70                 input=(String JavaDoc)e.nextElement();
71                 sb.setSearchInput(input,request.getParameter(input));
72                 LoggingManager.log("search input="+input+",request="+request.getParameter(input), this);
73             }//end for
74

75            // initialize the business object
76
SearchObject sobj = new SearchObject(vm, locale);
77
78            // retrieve the list from the business object
79
Vector sList = sobj.loadSearchResults( sb.getSearchInput(), sb.getOperator(), sb.isFilteredGrouping());
80            sb.setList(sList,locale,vm.getIdentification());
81            sb.setCurrentPage(1);
82         }//end else
83

84         if(request.getQueryString() != null)
85             sb.setURI(request.getRequestURI()+ "?" + request.getQueryString());
86         else
87             sb.setURI(request.getRequestURI());
88         
89         return Constants.SECTION_PUBLICS + Constants.DEFAULT_SPACER + element;
90
91     }
92
93 }
94
95 // eof
96
Popular Tags