1 / 8

How to Use Resource Command for Ajax in Liferay 7?

Eventually, while creating Liferay’s MVC framework, the resource URLs can be created in the JSPs for retrieving messages, XML or even any other kind of resource from the Liferay instance. This resource URL further invokes corresponding MVC resource command class (*MVCResourceCommand) that ultimately processes the resource request and response.<br>

AzilenTech
Download Presentation

How to Use Resource Command for Ajax in Liferay 7?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intro Asynchronous JavaScript and XML, popularly known as Ajax is used with Liferay technology to update portlet content or small portion of the whole page. Eventually, while creating Liferay’s MVC framework, the resource URLs can be created in the JSPs for retrieving messages, XML or even any other kind of resource from the Liferay instance. This resource URL further invokes corresponding MVC resource command class (*MVCResourceCommand) that ultimately processes the resource request and response.

  2. Resource Command for Ajax in Liferay 7 The resource command for Ajax calling in Liferay MVC framework is built for retrieving data as a response from the server. For this, a separate class is created as Resource Command class for handling Ajax calls. Previously in Liferay 6 Handler method was used to handle Ajax in the portlet controller. Example of Resource URL in JSP: When we hit resource URL from JavaScript or JSP, it will find corresponding MVCResourceCommand class. We can create our own class by implementing the MVCResourceCommand interface or extending the BaseMVCResourceCommand class.

  3. Sample MVC Resource Command Class:

  4. One has to define @Component annotation and javax.portlet.name value that will be the respective portletId. The portletId can be found by the controller class package and controller class name. For example, if the Controller class have package as com.example.learn.portlet and controller class name as “UserDocumentModulePortlet”, then the portletId will be com_example_learn_portlet. UserDocumentModulePortlet. Here, mvc.command.name must match with the id attribute in <portlet:resourceURL>. This is how Ajax call in Liferay 7 is done.

  5. Still in case of any queries, feel free to contact our Liferay Consultant!

  6. Original Source : http://www.azilen.com/blog/use-resource-command-ajax-liferay-7/

  7. Thanks You www.azilen.com Let us know if you have any Question! info@azilen.com | +1-972-325-2243

More Related