校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識(shí)庫 > jsp源碼實(shí)例4(搜索引擎)

jsp源碼實(shí)例4(搜索引擎)

熱門標(biāo)簽:長(zhǎng)春回?fù)芡夂粝到y(tǒng)廠家 山東智能云外呼管理系統(tǒng) 地圖標(biāo)注制作道路 珠海銷售外呼系統(tǒng)運(yùn)營(yíng)商 外呼系統(tǒng)啥意思 地圖標(biāo)注創(chuàng)業(yè)項(xiàng)目入駐 廣州三五防封電銷卡 電銷外呼系統(tǒng) 排行榜 四川電信外呼系統(tǒng)靠譜嗎
package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;


public class SearchEngines extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String searchString = request.getParameter("searchString");
if ((searchString == null) //
(searchString.length() == 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 = URLEncoder.encode(searchString);
String numResults = request.getParameter("numResults");
if ((numResults == null) //
(numResults.equals("0")) //
(numResults.length() == 0)) {
numResults = "10";
}
String searchEngine =
request.getParameter("searchEngine");
if (searchEngine == null) {
reportProblem(response, "Missing search engine name.");
return;
}
SearchSpec[] commonSpecs = SearchSpec.getCommonSpecs();
for(int i=0; icommonSpecs.length; i++) {
SearchSpec searchSpec = commonSpecs;
if (searchSpec.getName().equals(searchEngine)) {
String url =
searchSpec.makeURL(searchString, numResults);
response.sendRedirect(url);
return;
}
}
reportProblem(response, "Unrecognized search engine.");
}

private void reportProblem(HttpServletResponse response,
String message)
throws IOException {
response.sendError(response.SC_NOT_FOUND,
"H2>" + message + "/H2>");
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
您可能感興趣的文章:
  • jsp網(wǎng)頁搜索結(jié)果中實(shí)現(xiàn)選中一行使其高亮
  • jsp搜索引擎
  • php+ajax做仿百度搜索下拉自動(dòng)提示框(有實(shí)例)
  • asp+ajax仿google搜索提示效果代碼
  • jquery創(chuàng)建一個(gè)ajax關(guān)鍵詞數(shù)據(jù)搜索實(shí)現(xiàn)思路
  • asp.net和ajax實(shí)現(xiàn)智能搜索功能代碼
  • ThinkPHP實(shí)現(xiàn)ajax仿官網(wǎng)搜索功能實(shí)例
  • php+ajax實(shí)時(shí)輸入自動(dòng)搜索匹配的方法
  • ajax Suggest類似google的搜索提示效果
  • Ajax+Servlet+jsp顯示搜索效果

標(biāo)簽:紹興 潮州 玉樹 保定 肇慶 廣元 吳忠 北海

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《jsp源碼實(shí)例4(搜索引擎)》,本文關(guān)鍵詞  jsp,源碼,實(shí)例,搜索引擎,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《jsp源碼實(shí)例4(搜索引擎)》相關(guān)的同類信息!
  • 本頁收集關(guān)于jsp源碼實(shí)例4(搜索引擎)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 防城港市| 老河口市| 梅州市| 定结县| 洞头县| 密云县| 胶南市| 泸定县| 措勤县| 西平县| 同德县| 称多县| 广汉市| 白河县| 盖州市| 元谋县| 北川| 嘉黎县| 平果县| 绥棱县| 宁蒗| 化州市| 宝鸡市| 昭通市| 承德市| 东辽县| 大英县| 洛川县| 紫云| 犍为县| 海伦市| 信阳市| 芒康县| 晋江市| 镇沅| 娄底市| 鄂托克前旗| 宝应县| 塘沽区| 吴堡县| 上饶市|