Download Liferay Spring portlet from following location You can find source and war file Portlet Screen: Procedure for deploy portlet: You can use war file and directly place in your portal deploy folder and test or you can also use source to deploy portlet. Liferay have out box portlet support for Spring Portlets. Spring have annotation support so that we can develop portlet using annotation. Liferay portal already have all spring frame work jar files and hibernate jar file we can use same jar file in portlet or we can use latest spring jars in portlet. If we use the jars which are in liferay portal then application size will be become smaller. If we use our own jar files then portlet size will become more and if we deploy more portlets then each portlet context may have same spring and hibernate jars.
|Published (Last):||11 May 2015|
|PDF File Size:||19.14 Mb|
|ePub File Size:||16.51 Mb|
|Price:||Free* [*Free Regsitration Required]|
If you are a Liferay developer then you might have developed portlets in Liferay MVC which is very easy to use and its also very light weight. However Spring MVC is well known framework to develop java based enterprise applications. The Spring MVC not only famous for developing java based web applications but also it can be used in portlet development because of its cool features. After that we will convert it as a spring portlet.
Change the portlet class from com. DispatcherPortlet which is shown in below. This step is very important. So after changing the class name your portlet. The name of this xml file is generally depends on the name of the portlet and its format is [portlet-name]-portlet.
If its not found then it will throw exception. Note: If there is hyphen in the portlet name then we have to ignore it while creating the xml file. The good thing is that we are not required to download any jars. Liferay already provides those jars. We just need to mention which jars are required. Multiple packages can be separated by comma. The logical view will be resolved by the viewResolver as shown in the code.
For example if the controller returns a string "view" then it will be resolved as view. Step 7: Write a controller A spring controller is a java class which is annotated by Controller. A spring controller generally handles various request based on certain conditions.
We can give any name of the controller. RenderRequest; import javax. RenderResponse; import org. Controller; import org. RequestMapping; import org. RenderMapping; import com. Log; import com.
Hello World Spring MVC Portlet with annotations
Spring MVC Portlet Template