我使用oracle db和weblogic作爲web服務器。 從我的Android應用程序,我可以發送參數到我的遠程服務器.. 我的問題是如何獲得由我的查詢生成的結果集從我的服務器到我的ANDROID APP?從android遠程服務器獲取數據
我會很感激,如果有人點我做的一些例子...
String result = "";
//the year data to send
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("year","1980"));
//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://example.com/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
}
下面給出的代碼是我的jsp頁面...
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*,java.sql.*"%>
<%!
Connection con;
PreparedStatement ps;
String uname,pass;
ResultSet rs;
%>
<%
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","pro","pro");
ps=con.prepareStatement("select * from login_stud");
rs=ps.executeQuery();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
我想讓我的android應用程序檢索結果集「rs」....並將其顯示在手機屏幕上......如何做到這一點。如果你想要的細節抵消我的應用程序,你可以問我@dldnh
http://stackoverflow.com/questions/2323617/android -httppost - 如何對獲得最結果 – 2012-03-17 17:57:18