J2ME代码求注释
HttpConnectionconn=null;DataInputStreamdis=null;StringqueryString="searchBook=yes";St...
HttpConnection conn =null;
DataInputStream dis = null;
String queryString = "searchBook=yes";
String requestString = "&IP=" + textField1.getString();
String title;
try {
conn = MIDPConnector.open(queryString, requestString);
dis = new DataInputStream(conn.openDataInputStream());
title = dis.readUTF(); stringItem2.setText(title);
stringItem5.setText(dis.readUTF());
if(conn != null) conn.close();
if (dis != null) dis.close();
以上为客户端部分
try{
ip.IpAddressSearchWebServiceSoap port = service.getIpAddressSearchWebServiceSoap();
ip.Array0string result =port.getCountryCityByIp(ip);
DataOutputStream outs=new DataOutputStream(response.getOutputStream());
outs.writeUTF(result.getString(0));
outs.writeUTF(result.getString(1));
}catch(Exception ex)}
以上为服务器部分
public MIDPConnector() {
}public static HttpConnection open(String queryString, String searchString) throws IOException {
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
HttpConnection conn = null;
String urlString = bookstoreServerURL + "?" + queryString + searchString;
conn = (HttpConnection)Connector.open(urlString,Connector.READ_WRITE);
return conn;
以上为建立客户端和服务器的连接的MIDPConnector.java
整个代码是手机通过服务器调用Web服务的,在NetBeans平台下做的
求高手吧代码清楚地注释下,快答辩了,有的直接引用来的句子还不是很明白!谢谢!
已提高分数,要每句具体的注释 万分感谢 展开
DataInputStream dis = null;
String queryString = "searchBook=yes";
String requestString = "&IP=" + textField1.getString();
String title;
try {
conn = MIDPConnector.open(queryString, requestString);
dis = new DataInputStream(conn.openDataInputStream());
title = dis.readUTF(); stringItem2.setText(title);
stringItem5.setText(dis.readUTF());
if(conn != null) conn.close();
if (dis != null) dis.close();
以上为客户端部分
try{
ip.IpAddressSearchWebServiceSoap port = service.getIpAddressSearchWebServiceSoap();
ip.Array0string result =port.getCountryCityByIp(ip);
DataOutputStream outs=new DataOutputStream(response.getOutputStream());
outs.writeUTF(result.getString(0));
outs.writeUTF(result.getString(1));
}catch(Exception ex)}
以上为服务器部分
public MIDPConnector() {
}public static HttpConnection open(String queryString, String searchString) throws IOException {
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
HttpConnection conn = null;
String urlString = bookstoreServerURL + "?" + queryString + searchString;
conn = (HttpConnection)Connector.open(urlString,Connector.READ_WRITE);
return conn;
以上为建立客户端和服务器的连接的MIDPConnector.java
整个代码是手机通过服务器调用Web服务的,在NetBeans平台下做的
求高手吧代码清楚地注释下,快答辩了,有的直接引用来的句子还不是很明白!谢谢!
已提高分数,要每句具体的注释 万分感谢 展开
3个回答
展开全部
HttpConnection conn =null;
DataInputStream dis = null;
String queryString = "searchBook=yes";
String requestString = "&IP=" + textField1.getString();
String title;
try {
conn = MIDPConnector.open(queryString, requestString); //建立一链接
dis = new DataInputStream(conn.openDataInputStream());//建立输入流
title = dis.readUTF();//将字节流转成字符串。
stringItem2.setText(title);//应用字符串作为TITLE
stringItem5.setText(dis.readUTF());
if(conn != null) conn.close();//关链接
if (dis != null) dis.close();//关流
以上为客户端部分
try{
ip.IpAddressSearchWebServiceSoap port =
service.getIpAddressSearchWebServiceSoap();//获得需求
ip.Array0string result =port.getCountryCityByIp(ip);//处理
DataOutputStream outs=new DataOutputStream
(response.getOutputStream());//输出。
outs.writeUTF(result.getString(0));
outs.writeUTF(result.getString(1));
}catch(Exception ex)}
以上为服务器部分
public MIDPConnector() {//以下用来建立连接
}public static HttpConnection open(String queryString, String searchString) throws IOException {
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
HttpConnection conn = null;
String urlString = bookstoreServerURL + "?" + queryString + searchString;
conn = (HttpConnection)Connector.open(urlString,Connector.READ_WRITE);
return conn;
这程序没有难的吧!!?
DataInputStream dis = null;
String queryString = "searchBook=yes";
String requestString = "&IP=" + textField1.getString();
String title;
try {
conn = MIDPConnector.open(queryString, requestString); //建立一链接
dis = new DataInputStream(conn.openDataInputStream());//建立输入流
title = dis.readUTF();//将字节流转成字符串。
stringItem2.setText(title);//应用字符串作为TITLE
stringItem5.setText(dis.readUTF());
if(conn != null) conn.close();//关链接
if (dis != null) dis.close();//关流
以上为客户端部分
try{
ip.IpAddressSearchWebServiceSoap port =
service.getIpAddressSearchWebServiceSoap();//获得需求
ip.Array0string result =port.getCountryCityByIp(ip);//处理
DataOutputStream outs=new DataOutputStream
(response.getOutputStream());//输出。
outs.writeUTF(result.getString(0));
outs.writeUTF(result.getString(1));
}catch(Exception ex)}
以上为服务器部分
public MIDPConnector() {//以下用来建立连接
}public static HttpConnection open(String queryString, String searchString) throws IOException {
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
String bookstoreServerURL = "http://localhost:8080/Webtan/NewServlet";
HttpConnection conn = null;
String urlString = bookstoreServerURL + "?" + queryString + searchString;
conn = (HttpConnection)Connector.open(urlString,Connector.READ_WRITE);
return conn;
这程序没有难的吧!!?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询