正在使用JSR286开发springMVC portlet。我的portlet中有一个div,它将在我的模型中迭代一个集合,并显示如下所示
<dl>
<c:forEach var="product" items="${productList}">
<dt>
<div><img src="<%=request.getContextPath()%>/images/banner.jpg" /></div>
<div>${product.name} - ${product.price}</div>
<div>${product.serviceOne}</div>
<div>${product.servicetwo}</div>
<div>${product.serviceThree}</div>
</dt>
</c:forEach>
</dl>我有先前和下一个链接。在单击链接时,我需要异步(使用ajax)使用新内容刷新div。我正在使用jQuery编写脚本。我可以使用资源请求(资源映射url)替换模型中的集合。但是,我不知道如何在ajax成功中刷新div,以便在portlet中查看新集合。
技术人员给出你的建议。
发布于 2015-06-03 14:08:37
单独使用迭代逻辑创建了一个New。在资源请求中,我返回了jsp名称,因此视图解析器从视图文件夹中选择了相应的jsp,并返回执行的内容作为响应。我已经将内容放到了tha成功的div中。下面是代码
@ResourceMapping("filterProducts")
public String filterProducts(Model model, ResourceRequest request,
ResourceResponse response,
@ModelAttribute("productModel") ProductModel productModel,
ModelMap modelMap) throws IOException {
model.addAttribute("productModel", updatedProductModel);
return "productDetails";
}
$.ajax({
url : fltURL,
type : 'POST',
datatype : 'html',
success : function(_html) {
$('#midcontainer').html(_html);
},
error : function() {
alert('error');
}});
<portlet:resourceURL var="filterProductsURL" id="filterProducts"></portlet:resourceURL>https://stackoverflow.com/questions/30565667
复制相似问题