0
我有幾個問題,我希望得到一些幫助。我爲一個學校項目創建了以下代碼。該項目將建立一個Java Web應用程序,允許用戶輸入他們的郵政編碼和距離,並提交它返回最近的百思買商店位置。從API返回數據 - 我如何知道?
現在我已經寫了這個,並在Glassfish服務器上通過NetBeans運行它,並編譯並運行,顯示我的(現在未標記的)字段和提交按鈕。
什麼我的問題(s)爲(是):
有沒有辦法,我告訴我們,如果Java腳本實際上是在連接到百思買的API和返回的數據?
如何返回要在客戶端瀏覽器上輸出的結果(使用XML?)。目前,當我點擊「提交」時,這些字段變爲空白,並且瀏覽器中不顯示任何內容。
我一直在這個很長一段時間,看天,(有相當缺席教授),答案很可能是有目共睹的,但我初學編程經驗可能是失蹤了。
乾杯
<%--
Document : index.jsp
Created on : Apr 24, 2014, 3:42:41 PM
Author : Admin
--%>
<%@page
import="com.mattwilliamsnyc.service.remix.*;,java.util.List;,java.util.ArrayList;"%>
<!DOCTYPE html>
<html>
<head>
<title>Zip Code</title>
</head>
<body>
<Form Method="post" action="index.jsp">
<input type="text" name="zipcode"/>
<input type="text" name="distance"/>
<input type="submit" value="Search"/>
</form>
<%
String zipcode = request.getParameter("zipcode");
String distance = request.getParameter("distance");
List<String> storeFilters = new ArrayList<String>();
storeFilters.add("area('zipcode','distance')");
Remix remix = new Remix("6kzg5pqj73j29vrycjsgfvjt");
for (Store store : remix.getStores(storeFilters).list()) {
System.out.println(store.getName());
System.out.println(store.getPhone());
System.out.println(store.getAddress());
System.out.println();
}
%>
</body>
</html>
您不應該使用管理員帳戶使用您的計算機! –
@ErikAllik這對我的問題有什麼影響嗎? – MBlack
不準,只是爲了記錄。 –