Writing annotation based JSR 286 portlet using Spring 3.0 for WebSphere Portal 7 using RSA 8.0
Using this article I am trying to document step by step information for creating a JSR 286 basic portlet using Spring 3.0 Portlet MVC Framework on Rational Software Architect v 8.0 and WebSphere Portal Server v 7.0 Following steps are divided broadly into three sub-section :
Setting up RSA and Creating Portlet Project
Providing Spring Configuration and writing controller
Deploying and testing portlet
Setting up RSA and Creating Portlet Project :
1. Select New Project; select the option to show all wizards at the bottom to show portlet project option.
2. On the next screen put the project name and un-check option to create a portlet. Also create a new EAR Project if you don’t have any existing in your workspace.
3. Upon completion of the above step you should following structure created in you workspace:
4. Import Spring Jar files to EAR Assembly. To import Right Click on EAR Project, go to Import Option and select Java EE Utility Jar . You will see following screen:
5. Now import following Spring JAR files. Chose option to copy utility jars into the EAR project. You can download these library file from Spring WebSite:
· org.springframework.aop-3.0.0.RELEASE.jar
· org.springframework.asm-3.0.0.RELEASE.jar
· org.springframework.beans-3.0.0.RELEASE.jar
· org.springframework.context-3.0.0.RELEASE.jar
· org.springframework.core-3.0.0.RELEASE.jar
· org.springframework.expression-3.0.0.RELEASE.jar
· org.springframework.web-3.0.0.RELEASE.jar
· org.springframework.web.portlet-3.0.0.RELEASE.jar
· org.springframework.web.servlet-3.0.0.RELEASE.jar
At this point, you have setup your project successfully.
Providing Spring Configuration and writing controller :
1. Now first write a test controller for Spring Portlet. Following is a very basic controller which just forward control to the welcome page after being called.
2. Providing Spring Configuration:
Application Context Configuration
Add application level configuration file, whose entry is usually provided in web.xml. This file is used for declaring application level beans and configuration. For this sample we do not have any, so leaving it blank
Make Following entry to web.xml
Portlet Configuration :
You need to provide information about the handler, your controller and view resolver you are using. Add following Spring configuration for the portlet :
Make an entry into portlet.xml
At this point you are done with Spring configuration and basic portlet code for the sample portlet.
Deploying and Testing Sample Portlet
Now add this EAR to Portal Server and publish it.
Now hit the browser http://localhost:10039/wps/myportal/ [ FOR WPS 7.0 ] and you would see the welcome message of the portlet.
This article describes setting up and testing a basic JSR 286 Portlet implemented using Spring 3.0 Portlet MVC on WebSphere Portal 7.0 using Rational Software Architect.
Hope this helps--
Download the Source Code









