I am trying to understand these line, which are written in a jsp page:
<%@ page import="com.x.VoltDAOImpl" %>
<%!
VoltDAOImpl voltDao = new VoltDAOImpl();
Map<String , List<HashMap<String,String>>> returnList= null;
List<HashMap<String,String>> orderDetailsList1= null;
orderDetailsList1 = returnList.get("order_details");
JSONArray jsonArray = new JSONArray(orderDetailsList1);
%>
I'm a complete newbie to jsp and javascript, but I'm reading online and getting things done. What I understand from the above lines is that, it's importing from VoltDAOImpl class (calling the class which has some database), creating a HashMap orderDetailsList1
that gets "order_details"
. But, I don't what to use this jsp. I want to simply call this class in a javascript file and get this orderDetailsList1
as a json. I know, that I can convert some json string to json object using JSON.parse
, but how do I call this class and get the order_details as a json string in the first place??
I'm so confused. Please help!!!