Making Ajax request in portlets for liferay 6

user872220 picture user872220 · Aug 10, 2011 · Viewed 15.5k times · Source

I want to make an ajax call inside my jsp file which calls processAction method of a portlet, based on the success message from processAction method i need to make another call to serveResource method of portlet,please provide some examples..

Answer

Jignesh Shukla picture Jignesh Shukla · Sep 29, 2011

In portlets, processAction() methods are automatically followed by render method and hence ajax response will get embedded with HTML fragment generated by render method. So writing ajax in portlets is a bit tricky.

Have a look at this blog of mine.

http://ajax-and-portlets.blogspot.com/2011/09/ajax-best-practice-in-portlets.html

It gives an insight view of what's the best practice to implement ajax in portlets (for both JSR-168 and JSR-286 portlets).

In case you want sample portlets, you can contact me through the contact details from the blog. I'll be happy to help you.

Thanks Jignesh