How to Use Resource Command for Ajax in Liferay 7? - PowerPoint PPT Presentation

About This Presentation
Title:

How to Use Resource Command for Ajax in Liferay 7?

Description:

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. – PowerPoint PPT presentation

Number of Views:448
Slides: 9
Provided by: AzilenTech
Category: Other

less

Transcript and Presenter's Notes

Title: How to Use Resource Command for Ajax in Liferay 7?


1
(No Transcript)
2
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 Liferays 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.

3
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.

1 ltportletresourceURL id"getUserDocuments"var"getUserDocumentsURL" /gt
4
  • Sample MVC Resource Command Class

5
  • One has to define _at_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 ltportletresourceURLgt.
  • This is how Ajax call in Liferay 7 is done.

6
  • Still in case of any queries, feel free to
    contact our Liferay Consultant!

7
  • Original Source
  • http//www.azilen.com/blog/use-resource-command-aj
    ax-liferay-7/

8
Thanks You www.azilen.com Let us know if you
have any Question! info_at_azilen.com
1-972-325-2243
Write a Comment
User Comments (0)
About PowerShow.com