我需要刷新一个table
在页面上,无需重新加载整个页面。有谁知道这样做的好方法吗?
我创建了单独的 jspf
包含一张表的页面,并通过 Ajax 请求呈现它 <portlet:renderURL
>,但页面以默认的 liferay 主题换行。有没有其他方法可以在没有主题的情况下获取页面日期?
<portlet:renderURL var="testURL">
<portlet:param name="jspPage" value="/jspf/test.jspf" />
</portlet:renderURL>
<script>
$("#test-button").click(function() {
$("#test-table").load("<%= testURL %>");
})
</script>
最佳答案
要在 Liferay-MVC 中使用 Ajax,您应该创建一个 resourceURL
链接并在 Portlet 类中的 serveResource
方法中处理它。
<portlet:resourceURL var="testURL">
<portlet:param name="pageAddress" value="/jspf/test.jspf" />
</portlet:resourceURL>
<script>
$("#test-button").click(function() {
$("#test-table").load("<%= testURL %>");
})
</script>
那么您应该在 portlet 类的 serveResource
方法中提供正确的结果。
另外,您可以使用 resourceRequest
对象
String pageAddress = resourceRequest.getParameter("pageAddress");
关于jsp - 刷新 Liferay MVC portlet 中的部分 JSP 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14293481/