Search code examples
liferay-6

Return Html Snippet with by Ajax


I am trying to send the HTML response form the Ajax Call. Exactly I want to render a JSP and return the resulted HTML String as the response. I tried to follow the steps given in the following post. https://www.liferay.com/community/forums/-/message_boards/message/4940181 But I could not found the methods in PortalUtil class. I am using LR6.2.


Solution

  • This can be done by including a jsp in the response.

     getPortletContext().getRequestDispatcher("/WEB-INF/jsp/html.jsp").include(p_request, p_response);
    

    Once the control is passed to the JSP, it will act like the normal JSPs, you can get the vales from request and go ahead with the manipulations.