Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between doView() and render() functions in Liferay?

What is the actual difference between doView() and render() functions in Liferay? and also what is the difference between renderRequest and resourceRequest?

like image 341
rkg Avatar asked Jul 17 '12 08:07

rkg


1 Answers

doView() = to handle render requests when in VIEW mode.

render() = This method invokes the doDispath() method and sets the title of the portlet by using getTitle() method. Then it invokes one of doView(), doEdit(), doHelp(), etc. depending of the portlet mode specified in the RenderRequest.


Again, RenderRequest is when you want to handle requests in the VIEW mode of the portlet. If your portlet uses additional resources to render the view (i.e. images, JavaScript files, etc.) then the JSP that renders the view will use <portlet:resourceURL /> tags to generate valid URLs to those resources. Those URLs will be processed with a pair of ResourceRequest and ResourceResponse objects.

You can override the resource phase though but bear in mind that when you use ResourceRequest/ResourceResponse to serve, the portlet can't change the current portlet mode, window state or render parameters. And also the parameters set on the resource urls are not the render parameters and they are valid to serve only that current resource request.

like image 65
Sharana Avatar answered Sep 20 '22 21:09

Sharana