我想在下拉列表的值发生变化时重新加载搜索容器的数据。
我编写了AJAX代码来调用serveResource()
方法并传递下拉值,但我不确定如何使用新数据重新加载或刷新搜索容器。
<portlet:resourceURL var="xxxResourceURL" id="/A.jsp" escapeXml="false"/>
A.io.request("<%=xxxResourceURL%>", {
method: 'POST',
data: {
data1: vid,
data2:ltypeid
},
on: {
success: function() {
alert(this.get('responseData')); //alerts 2
A.one("#prodDiv").setContent(this.get('responseData'));
}
}
});
A.jsp
<%
List prodList=Collections.emptyList();
try {
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
String d1= PortalUtil.getOriginalServletRequest(httpReq).getParameter("data1");
String d2= PortalUtil.getOriginalServletRequest(httpReq).getParameter("data2");
System.out.println("JSP-->Vendor Id is**"+d1);
System.out.println("JSP-->License Type Id is**"+d2);
DynamicQuery prodQuery=XXXMasterLocalServiceUtil.getProdcuts(Long.parseLong(d1), Long.parseLong(d2));
prodList=XXXMasterLocalServiceUtil.dynamicQuery(prodQuery);
out.println("<liferay-ui:search-container headerNames=\"Product Name\">");
out.println("<liferay-ui:search-container-results results='"+prodList+"' total='"+prodList.size()+"''/>");
out.println("<liferay-ui:search-container-row className=\"com.liferay.lms.model.ProductMaster\" escapedModel='true' keyProperty=\"productId\" modelVar=\"product\">");
out.println("<liferay-ui:search-container-column-text name=\"Product Name\" property=\"productName\" />");
out.println("</liferay-ui:search-container-row>");
out.println("<liferay-ui:search-iterator paginate=\"true\" />");
out.println("</liferay-ui:search-container>");
} catch(Exception e) {
System.out.println("Exception is"+e.getMessage());
e.printStackTrace();
}
%>
请帮忙!