Refresh a portion of a JSP page in a Liferay MVC portlet

I need to update one table per page without reloading the full page. Does anyone know a good method to do this?

I created a separate jspf page with one table and displayed it at the request of Ajax <portlet:renderURL >, but the page wraps itself in the default liferay theme. Is there any other way to get a page date without a topic?

 <portlet:renderURL var="testURL"> <portlet:param name="jspPage" value="/jspf/test.jspf" /> </portlet:renderURL> <script> $("#test-button").click(function() { $("#test-table").load("<%= testURL %>"); }) </script> 
+4
source share
1 answer

To use Ajax in Liferay-MVC, you must create a resourceURL link and process it in the serveResource of the portlet class.

 <portlet:resourceURL var="testURL"> <portlet:param name="pageAddress" value="/jspf/test.jspf" /> </portlet:resourceURL> <script> $("#test-button").click(function() { $("#test-table").load("<%= testURL %>"); }) </script> 

then you must ensure the correct result in the serveResource method of your portlet class. in addition, you can get your parameter (pageAddress) with the resourceRequest Object

 String pageAddress = resourceRequest.getParameter("pageAddress"); 
+2
source

All Articles