/Users/lyon/j4p/src/net/server/sendmail/WebSearch.java

1    package net.server.sendmail; 
2     
3    import javax.servlet.http.HttpServletRequest; 
4     
5    public class WebSearch { 
6     
7        boolean m_bSuccess = false;         // Indicates that properties have been properly initialized 
8        static String m_sError = null;      // Flags an error condition to the client 
9        String m_sSearchString = null;      // The message to be emailed 
10       String m_sRecipientEmail = null;    // The recipient's email address 
11    
12    
13       /************************************************************** 
14        *  No-arg constructor 
15        **************************************************************/ 
16       public WebSearch() { 
17           System.out.println("\n*** Starting WebSearch"); 
18       }//end constructor 
19    
20    
21       /************************************************************** 
22        *  Method processRequest 
23        *  Gets input parameters from the jsp and then acts as the 
24        *  main method 
25        **************************************************************/ 
26       public void processRequest(HttpServletRequest request) { 
27           m_sSearchString = request.getParameter("txtSearch"); 
28           m_sRecipientEmail = request.getParameter("txtEmail"); 
29    
30           m_sError = null; 
31           m_bSuccess = false; 
32    
33           //-- Check for blank fields before setting email properties 
34           if ((this.m_sSearchString == null) | 
35                   (this.m_sRecipientEmail == null)) { 
36               m_bSuccess = false; 
37           } else if ((m_sSearchString.equals("")) | 
38                   (m_sRecipientEmail.equals(""))) { 
39    
40               m_bSuccess = false; 
41           } else { 
42    
43               m_bSuccess = true; 
44   //-- Create a new instance of the SearchThread class, initialize properties 
45               new SearchThread(m_sSearchString, 
46                       m_sRecipientEmail); 
47           } 
48       }// end method 
49    
50    
51       /************************************************************** 
52        *  Method getError 
53        *  @return String representing an error message 
54        *  Accessor method used by the JSP for handling 
55        **************************************************************/ 
56       public String getError() { 
57           return m_sError; 
58       } 
59    
60    
61       /************************************************************** 
62        *  Method getSearchString 
63        *  @return String representing representing the search criteria 
64        *  Accessor method used by the JSP to display the search string 
65        **************************************************************/ 
66       public String getSearchString() { 
67           return m_sSearchString; 
68       } 
69    
70    
71       /************************************************************** 
72        *  Method success 
73        *  @return boolean indicating whether the properties have 
74        *  been set correctly in order to proceed with the search 
75        **************************************************************/ 
76       public boolean success() { 
77           return m_bSuccess; 
78       } 
79    
80    
81   }// end class 
82    
83    
84