⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 siteclient.java

📁 这是一个关于初学者怎样在java环境下学习简单数据库操作的例子
💻 JAVA
字号:
import java.io.*;
import java.util.*;
import java.net.*;
import org.apache.xmlrpc.*;

public class SiteClient {
    String url;
    String title;
    String description;

    public static void main(String arguments[]) {
        SiteClient client = new SiteClient();
        try {
            Vector response = client.getRandomSite();
            // Report the results
            if (response.size() > 0) {
                client.url = response.get(1).toString();
                client.title = response.get(2).toString();
                client.description = response.get(3).toString();
                System.out.println("URL: " + client.url
                    + "\nTitle: " + client.title
                    + "\nDescription: " + client.description);
            }
        } catch (IOException ioe) {
            System.out.println("IO Exception: " + ioe.getMessage());
            ioe.printStackTrace();
        } catch (XmlRpcException xre) {
            System.out.println("XML-RPC Exception: " + xre.getMessage());
        }
    }

    public Vector getRandomSite()
      throws IOException, XmlRpcException {

            // Create the client
            XmlRpcClient client = new XmlRpcClient(
                "http://cadenhead.org:4413/");
            // Create the parameters for the request
            Vector params = new Vector();
            // Send the request and get the response
            Vector result = (Vector) client.execute("dmoz.getRandomSite", params);
            return result;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -