2024年5月11日发(作者:)

Jsp搜索引擎源代码

package coreservlets;

import .*;

import t.*;

import .*;

import .*;

public class SearchEngines extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException {

String searchString = ameter("searchString");

if ((searchString == null) ||(() == 0)) {

reportProblem(response, "Missing search string.");

return;

}

// The URLEncoder changes spaces to "+" signs and other

// non-alphanumeric characters to "%XY", where XY is the

// hex value of the ASCII (or ISO Latin-1) character.

// Browsers always URL-encode form values, so the

// getParameter method decodes automatically. But since

// we"re just passing this on to another server, we need to

// re-encode it.

searchString = (searchString);

String numResults = ameter("numResults");

if ((numResults == null)

(("0"))

(() == 0)) {

numResults = "10";