// 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);