Liferay Portlet:-
"Portlets are hot deployable small web applications that run in a portion of a web page and it is managed by portlet container". Portlets produce fragments of markup code that are aggregated into a portal page, not complete documents.
Portlet hierarchy:-
JSR 168 lifecycle :-
init() --> processAction() --> render() --> destroy()
JSR 286 Lifecycle for IPC Event:-
init() --> processAction() --> processEvent() --> render() --> destroy()
Note :- The serveResource() method can be used to implement Ajax call, by invoking the resource URL through the XMLHttpRequest(or XMLPortletRequest) in client-side JavaScript code.
Liferay Portlet Modes:-
mainly liferay containing 3 types of modes
1.VIEW 2.EDIT 3.HELP
In additional to it Liferay contains 6 other modes
1.About 2. Config 3. Preview 4.Print 5.Edit Defaults 6.Edit Guests
"Portlets are hot deployable small web applications that run in a portion of a web page and it is managed by portlet container". Portlets produce fragments of markup code that are aggregated into a portal page, not complete documents.
Portlet hierarchy:-
Portlet Specifications:-
There are following two types of specifications :-
Portlet Specification 1.0 (JSR168)
Portlet Specification 2.0 (JSR 286)
JSR 168 covers the basic portlet development but Java Community People was added more features and specification in JSR 286.
The following are important Specification and Features in JSR 286 :-
• Inter Portlet Communication
• Another State in Lifecycle
• Ajax Support
• Serving Resources
• Portlet Filter and Listeners
JSR 168
|
JSR 286
|
|
1
|
ActionURL
|
ActionURL
|
RenderURL
|
RenderURL
|
|
ResourceURL
|
||
2
|
Window States
|
Window States
|
(min)
|
(min)
|
|
(max)
|
(max)
|
|
(normal)
|
(normal)
|
|
3
|
Portlet Modes
|
Portlet Modes
|
(view)
|
(view)
|
|
(help)
|
(help)
|
|
(edit)
|
(edit)
|
|
4
|
IPC (Inter Portlet
Communication)
|
Introduction to Portlet Phases and Lifecycle Methods:-
Portlet performs unique operation in each lifecycle execution which are known as portlet phases.
initially following two portlet phases are defined in JSR-168 (Portlet 1.0) specification :-
Render Phase
Action Phase
Later following twomore portlet phases are added in JSR-286 (Portlet 2.0) specification:-
Event Phase
Resource Serving Phase
Lifecycle methods of Portlet:-
1)init()
This method will be called when portlet is deployed and instantiated by portlet container.
2)render()
This method will be called to render the content. Represent Render phase.
3)processAction()
This method will be called when any action performed.
4)processEvent()
This method will be called when any event is triggered.
5)serveResource()
This method will be called when any resource is served with resource URL.
6)destroy()
This method will be called when portlet is un-deployed by portlet container.
JSR 168 lifecycle :-
init() --> processAction() --> render() --> destroy()
JSR 286 Lifecycle for IPC Event:-
init() --> processAction() --> processEvent() --> render() --> destroy()
Note :- The serveResource() method can be used to implement Ajax call, by invoking the resource URL through the XMLHttpRequest(or XMLPortletRequest) in client-side JavaScript code.
Liferay Portlet Modes:-
mainly liferay containing 3 types of modes
1.VIEW 2.EDIT 3.HELP
In additional to it Liferay contains 6 other modes
1.About 2. Config 3. Preview 4.Print 5.Edit Defaults 6.Edit Guests
Liferay Portlet URLs:-
1. Render URL (which is portlet URL and responsible for rendering of the portlet and method doView() is executed)
2. Action URL (which is also portlet URL and responsible for performing some action with page reload and method processAction() is executed, and is followed by renderRequest)
3. Resource URL (which is responsible for performing some action without page reload i.e. Ajax and method serveResource() is executed and is NOT followed by render request. Resource Serving was not available in JSR168 but its avaible in JSR286.
Window state:- The liferay window state are Normal, Maximized , minimized and pop_up.