What is the actual difference between doView()
and render()
functions in Liferay? and also what is the difference between renderRequest
and resourceRequest
?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With