0
我正在開發android應用程序,我正在使用jsp進行mysql連接。在JSP中使用json_encode的另一種方式是什麼?因爲它專用於PHP。json_encode在JSP中的替代用法
我正在開發android應用程序,我正在使用jsp進行mysql連接。在JSP中使用json_encode的另一種方式是什麼?因爲它專用於PHP。json_encode在JSP中的替代用法
試試這個像在PHP json_encoded它會正常工作
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="org.json.simple.JSONObject"%>
<%
JSONObject json = new JSONObject();
json.put("name", "john");
json.put("mobile", "999999999");
out.print(json);
out.flush();
%>
檢查這個答案http://stackoverflow.com/questions/3207092/what-is-the-jsp-equivalent-to-json- encode-in-php –
謝謝。我已經檢查過,但仍然需要研究如何使用和實施 – Kirby