Here are the steps that can probably help you in converting a Struts application to a Portlet.
Environment used by me : IBM RAD 7, Websphere, Liferay 5.2.3, Oracle 10g
Environment that you can use : Any IDE preferbly Eclipse/JBoss/IBM RAD, Portal Server of your choice like Liferay/JBOSS/Apache/IBM Portal, Oracle/Mysql/SQL Server Database
Tools used by me : Apache Struts Portal Bridge: Details at apache.org
1. For this article we will employ Apache Portal Bridge. The reason I have used it is because if you dont use this then you will have to make changes to your action classes and jsp's as per JSR 168/286 specification.
2. First step will be to get Liferay up and running on your application server. For me it was IBM Websphere 6.1
I basically used Liferay Portal 5.2.3(without dependencies) and then downloaded the dependencies separately. You can follow the admin guide for setting up Liferay on any server.
The important point to keep in mind is :
portal-ext.properties file to specify Database configuration and hibernate dialect settings. Place this in
3. Setup the database by executing the create-minimal script.
4. Install the Liferay war in your application server. Check logs for any possible errors.
5. Start Liferay and check for http://localhost:9080.
6. Once you are done with this then next step will be to convert your application to JSR Portlet.
Start by downloading the Apache Struts Portal Bridge from Apache.
If you are working with IBM Websphere 6.1 the you need to take care of two things:
a. IBM has its own Portal Server which acts as the default server. You need to stop that so that Liferay can pick your application. To do this follow the following links:
Exploiting the WebSphere Application Server V6.1 portlet container
PK34915: allow web applications to disable portlet deployment
To disable portlet deployment this APAR, PK34915 is required and the portlet application must set the context parameter
"com.ibm.websphere.portletcontainer.PortletDeploymentEnabled" to "false" within the web.xml.
For doing this you will need IBM Update Installer. If you dont have one follow this "http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg24012718" target="_blank">link
b. In portal-ext.properties you need to define a websphere-deploy folder where Liferay places the war that is placed in the deploy folder. It is this war that you need to install in IBM Websphere.
Here is a sample from my properties file:
changes in portal-ext.property file : which is most important
You also need to specify a websphere-deploy folder where Liferay will place your war
After this you need to copy all the dependency libraries to the lib folder in web-inf.
If your Web Application uses EJB then you need to setup EJB as a separate jar in Websphere or JBoss. Next access them remotely from your web application.
Check the portlet.xml file, it should have a the Portlet name defined.
You dont need anything in web.xml except for EJB references.
Final Checklist would be:
1. The web.xml doesn't need any entries at all for Struts 2.1.6 version.
2. Both the ServletContextHolderListener and the Preparator servlet have been depracated. So you don't need them anymore.
3. The FilterDispatcher filter appears to be optional.
4. The DispatcherServlet only need to be included in the deployment descriptor if JSTL tags are needed by your application.
5. Configure the liferay specific descriptors (liferay-portlet.xml, liferay-display.xml) as usual.
6. In the liferay-plugin-package.properties file, You must include the following Liferay portal jar dependencies: freemarker.jar,
7. In your portlet /lib folder, include these required Struts 2 jar files: struts2-core-2.1.6.jar, struts2-portlet-plugin-2.1.6.jar, xwork-2.1.2.jar, ognl-2.6.11.jar
8. Your struts.xml descriptor should be located in the classes folder.
Export your Web Application as WAR and install it to your server along with any EJB jars.
You should be all set then.
In my next Post I will cover some important links/references and also what changes you will need in the jsp files.