I have code as below, I want to do all in Java code to create categoryListMap object, then convert to categoryList, how can I do?
...
var categoryList = [];
<%
List<Object> modelMaster = psiSearchForm.getModelMaster();
String parentKey = "";
String categoryKey = "";
String text = "";
for (int i = 0; i < modelMaster.size(); i++) {
Map option = (Map) modelMaster.get(i);
parentKey = (String)option.get(ConstantContainer.MODALITY);
categoryKey = (String)option.get(ConstantContainer.CATEGORY);
text = categoryKey + ": " + (String)option.get(ConstantContainer.CATEGORY_NAME);
%>
categoryList.push({
parent: "<%=parentKey%>",
key: "<%=parentKey%><%=categoryKey%>",
text: "<%=text%>"
});
<%
}
%>