Results 1 to 2 of 2
  1. #1
    morya123 is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default search key in servlet

    i have got this code for searching a particulate word from a XML list!

    i just want to ask how can i make some changes in the code so that that same code could give me option for searching for 2 words or 3 words at a time



    example!!

    right now that code is giving me output of search word "ABC" . it disply all the excat match of ABC in xml sheet !!! i want to search fro "ABC PQR ZZWQ"

    like that!


    using a single search key to search a perticular word i want to search entire line with spaces


    my code

    Java Code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    public class NegativeListServlet extends HttpServlet{
    	final String pResourcePath = "C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/NegativeList/WEB-INF/res/consolidatedlist.xml" ;
    	public void doPost(HttpServletRequest pRequest, HttpServletResponse pResponse)throws ServletException,IOException {
    		try{
    		String lSearchkey = pRequest.getParameter("Searchkey") ==null ? "" :  pRequest.getParameter("Searchkey");
    		//System.out.println("Search for "+lSearchkey );
    		XmlDataExtracter lObject = new XmlDataExtracter(pResourcePath);
    		
    		List<Map> lSearchList = lObject.search("SORT_KEY",lSearchkey);
    		//System.out.println("Result "+lSearchList );
    		RequestDispatcher lRequestDispatcher = pRequest.getRequestDispatcher("Search.jsp");
    		pRequest.setAttribute("SearchResult" , lSearchList );
    
    		lRequestDispatcher .forward(pRequest,pResponse);
    		}catch(Exception e){
    			e.printStackTrace();
    		}
    	}
    }

  2. #2
    morya123 is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 10-29-2009, 09:28 AM
  2. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  3. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  4. Replies: 5
    Last Post: 08-26-2008, 03:43 PM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •