In the previous blog Developing a MVCPortlet with Multiple Actions in Liferay we see how we can handle multiple action methods in a single portlet. Today we will discuss how to develop a MVCPortlet with multiple render methods in Liferay. Here we create a portlet that contain 4 render methods that will redirect to different jsps that contain simple messages.So lets start this step by step:-
Step 1:-Create Liferay Project and Portlet
Create a Liferay plugin project and than create a portlet in it. You can check snapshot in my previous blog Developing a MVCPortlet with Multiple Actions in Liferay.
Here we create a method customRenderMethod that check the value of parameter nameofjsp and then set the parameter mvcPath.
Step 4:-Check the Output
Deploy the portlet and add this to a page :-
Create a Liferay plugin project and than create a portlet in it. You can check snapshot in my previous blog Developing a MVCPortlet with Multiple Actions in Liferay.
Step 2:-Change view.jsp
Open view.jsp and paste this content:-
view.jsp
Explanation:-
Here we simply 4 URLs 2 renderURLs that use param mvcPath that will redirect to corresponding jsps. And 2 actionURLs that go to controller where we redirect to different jsps.
Step 3:-Change the Controller
Open your java class and paste this:-
Demo.java
Explanation:-Open view.jsp and paste this content:-
view.jsp
Explanation:-
Here we simply 4 URLs 2 renderURLs that use param mvcPath that will redirect to corresponding jsps. And 2 actionURLs that go to controller where we redirect to different jsps.
Step 3:-Change the Controller
Open your java class and paste this:-
Demo.java
Here we create a method customRenderMethod that check the value of parameter nameofjsp and then set the parameter mvcPath.
Step 4:-Check the Output
Deploy the portlet and add this to a page :-
Project Structure:-
Hope this will Help....
You can Download Source code from Multiple Render Method in MVCPortlet.
Related Post:-
You can Download Source code from Multiple Render Method in MVCPortlet.
Related Post:-
Developing a MVCPortlet with Multiple Actions in Liferay
Categorization in web content
Fetch Web Contents Programmatically
Get Journal Article Fields Programmatically
Embedding a Portlet in Web Content
Creating tabs using Web Content
Embedding a Web Content/Journal Article in a Portlet
Index Post Processor Hook
Categorization in web content
Fetch Web Contents Programmatically
Get Journal Article Fields Programmatically
Embedding a Portlet in Web Content
Creating tabs using Web Content
Embedding a Web Content/Journal Article in a Portlet
Index Post Processor Hook
No comments:
Post a Comment