人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

jsp搜索引擎

jsp搜索引擎

更新時間:2022-08-02 文章作者:未知 信息來源:網絡 閱讀次數:


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; i<commonSpecs.length; i++) { 
SearchSpec searchSpec = commonSpecs[i]; 
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); 


溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 肥西县| 莲花县| 信丰县| 洪雅县| 梁山县| 庆城县| 西乌珠穆沁旗| 崇州市| 同仁县| 博野县| 临城县| 望都县| 泸水县| 格尔木市| 桓仁| 吴川市| 汽车| 册亨县| 临江市| 永康市| 米林县| 珲春市| 冕宁县| 牡丹江市| 弥渡县| 承德县| 新巴尔虎左旗| 鄂州市| 安仁县| 宁陕县| 兴和县| 公主岭市| 通化县| 平定县| 崇明县| 尚志市| 精河县| 梁河县| 兴安盟| 湄潭县| 神池县|