i am returning a json array from java class as return type and trying to display data on jsp page. everything is ok (as debugging says). But dont know the method (code/syntax) for jsp/html page. class
JSONArray jsonArray = new JSONArray();
public JSONArray get_user() {
String sql = "SELECT * FROM USER_INFO";
try {
con = new connection.connect().getConnection();
smt = con.createStatement();
rset = smt.executeQuery(sql);
while (rset.next()) {
JSONObject obj = new JSONObject();
obj.put("Email", rset.getString(2));
obj.put("Password", rset.getString(3));
jsonArray.put(obj);
}
} catch (Exception ex) {
ex.getMessage();
}
return jsonArray;
}
jsp
<%
controller.fetch_user obj = new controller.fetch_user();
obj.get_user();
%>
<table>
<tr><td>Email</td><td>Password</td></tr>
*** here i want to display all the records ****
</table>