FileDocCategorySizeDatePackage
SearchLogic.javaAPI DocExample1073Thu Apr 05 20:19:46 BST 2001None

SearchLogic

public class SearchLogic extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

    // We don't set the content type or get a writer

    // Get the string to search for
    String search = req.getParameter("search");

    // Calculate the URLs containing the string
    String[] results = getResults(search);

    // Specify the results as a request attribute
    req.setAttribute("results", results);

    // Forward to a display page
    String display = "/servlet/SearchView";
    RequestDispatcher dispatcher = req.getRequestDispatcher(display);
    dispatcher.forward(req, res);
  
java.lang.String[]getResults(java.lang.String search)

    return new String[] { "http://www.abc.com",
                          "http://www.xyz.com" };