FileDocCategorySizeDatePackage
SearchView.javaAPI DocExample1074Thu Apr 05 20:19:56 BST 2001None

SearchView

public class SearchView extends HttpServlet

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

    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();

    // Get the search results from a request attribute
    String[] results = (String[]) req.getAttribute("results");

    if (results == null) {
      out.println("No results.");
      out.println("Did you accidentally access this servlet directly?");
    }
    else {
      out.println("Results:");
      for (int i = 0; i < results.length; i++) {
        out.println(results[i]);
      }
    }

    out.println();
    out.println("Request URI: " + req.getRequestURI());
    out.println("Context Path: " + req.getContextPath());
    out.println("Servlet Path: " + req.getServletPath());
    out.println("Path Info: " + req.getPathInfo());
    out.println("Query String: " + req.getQueryString());