index-jsp.jsp
资源名称:totsearch.rar [点击查看]
上传用户:guomengjz
上传日期:2022-06-06
资源大小:726k
文件大小:2k
源码类别:
搜索引擎
开发平台:
C/C++
- <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
- <%@page import="java.net.*"%>
- <%@page import="java.util.*"%>
- <%@page import="java.io.*"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- </head>
- <body>
- <%!
- public String PostUrl(String actionurl,String data){
- String ret="";
- try{
- URL url = new URL(actionurl);
- URLConnection connection = url.openConnection();
- connection.setDoOutput(true);
- OutputStreamWriter outer = new OutputStreamWriter(connection.getOutputStream(),"utf-8");
- outer.write(data);
- outer.close();
- BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(),"utf-8"));
- String inlin="";
- while ((inlin = in.readLine()) != null) {
- ret+=inlin;
- }
- in.close();
- }catch(Exception e){
- }
- return ret;
- }
- %>
- <%
- String SearchPortal="http://www.test.com/totindex.aspx";//淘特搜索引擎索引接口地址
- String IndexKey="totsearchengine01";//接口访问key,请通过搜索引擎中的web.config查找
- String str="";
- //添加索引
- str=PostUrl(SearchPortal,"key="+IndexKey+"&action=insert&id=1&Title=测一下试&Content=test&Categoryid=0&Summary=test&Photo=a&ModDate=2010-1-1&LinkUrl=test");
- out.print(str);
- out.print("<br>");
- //删除索引
- str=PostUrl(SearchPortal,"key="+IndexKey+"&action=delete&id=1");
- out.print(str);
- %>
- </body>
- </html>