Add a portlet to Liferay 5 (deployed in Liferay's Portlet Container)
Posted by eichelgartenweg on 11:34 AM with 4 comments
In this post i will discribe the manual deployment of portlets in WebSphere.
To get some information about the auto deployment of portlets in WebSphere, check out this post.
Manually installation of a portlet in liferays portlet container isnt an easy think but its doable.
I try to explain the procedure with an simple (self created) sample (non-struts) JSP-Portlet.
The portlet just prints out:
Hello - username - how are you?
Download it here
Steps:
1. Copy the JSP-Files of the portlet to "liferay_folder"/html/portlet/welcome/
("welcome" is the portlet name)
2. Add an <portlet>-entry to WEB-INF/portlet-custom.xml
5.1 Open portal-impl.jar//content/language-"your needed region codes".properties (Hint: use Winrar)
5.2 Add an entry for the portlet title
6. Restart server
7. After the restart it's possible to add the welcome-portlet via the "Add Application" menu

If you want to deploy a struts portlet you have to additionally edit the struts-config.xml and the tiles-def.xml.
If you downloaded a portlet form liferay.com its a bit easier.
Open the downloaded war-file and take a look at the delivered xml-files.
These files just contain the additional entries needed for this portlet.
Copy these entries and paste them in the xmls located in your liferay installation.
Also extract all resources (classes,jars, jsps) to the corresponding folder.
Restart the server and thats it.
Picture (maybe it helps :-) :
Alternative:
Use an ext-enviroment and choose websphere as app-server
Links:
http://wiki.liferay.com/index.php/How_to_create_a_simple_portlet
To get some information about the auto deployment of portlets in WebSphere, check out this post.
Manually installation of a portlet in liferays portlet container isnt an easy think but its doable.
I try to explain the procedure with an simple (self created) sample (non-struts) JSP-Portlet.
The portlet just prints out:
Hello - username - how are you?
Download it here
Steps:
1. Copy the JSP-Files of the portlet to "liferay_folder"/html/portlet/welcome/
("welcome" is the portlet name)
2. Add an <portlet>-entry to WEB-INF/portlet-custom.xml
<portlet>
<portlet-name>welcome</portlet-name>
<display-name>Welcome to Liferay 5</display-name>
<portlet-class>com.liferay.portlet.JSPPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/portlet/welcome/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
3. Add an entry to WEB-INF/liferay-portlet.xml<portlet-name>welcome</portlet-name>
<display-name>Welcome to Liferay 5</display-name>
<portlet-class>com.liferay.portlet.JSPPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/portlet/welcome/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
<portlet>
<portlet-name>welcome</portlet-name>
<struts-path>mnet_welcome</struts-path>
<restore-current-view>false</restore-current-view>
<private-request-attributes>false</private-request-attributes>
<ajaxable>false</ajaxable>
</portlet>
4. Add an entry to WEB-INF/liferay-display.xml<portlet-name>welcome</portlet-name>
<struts-path>mnet_welcome</struts-path>
<restore-current-view>false</restore-current-view>
<private-request-attributes>false</private-request-attributes>
<ajaxable>false</ajaxable>
</portlet>
<category name="category.ownportlets">
<portlet id="welcome" />
</category>
5. Add an entry to the language-xx.property-files (located in WEB-INF/lib/portal-impl.jar)<portlet id="welcome" />
</category>
5.1 Open portal-impl.jar//content/language-"your needed region codes".properties (Hint: use Winrar)
5.2 Add an entry for the portlet title
javax.portlet.title.welcome=Welcome
5.3 Add an entry fot the category namecategory.ownportlets=Own portlets
5.4 Save portal-impl.jar6. Restart server
7. After the restart it's possible to add the welcome-portlet via the "Add Application" menu

If you want to deploy a struts portlet you have to additionally edit the struts-config.xml and the tiles-def.xml.
If you downloaded a portlet form liferay.com its a bit easier.
Open the downloaded war-file and take a look at the delivered xml-files.
These files just contain the additional entries needed for this portlet.
Copy these entries and paste them in the xmls located in your liferay installation.
Also extract all resources (classes,jars, jsps) to the corresponding folder.
Restart the server and thats it.
Picture (maybe it helps :-) :

Use an ext-enviroment and choose websphere as app-server
Links:
http://wiki.liferay.com/index.php/How_to_create_a_simple_portlet
Hi!!!!
ReplyDeleteI install a portlet automatically with Websphere in Liferay
1.-Move the JAR-file portal-kernel.jar from "Liferay" to /"WebSphere System Root"/lib/ext
2.-Download "sample-jsp-portlet-5.0.0.1.war"
3.-Download the correct web.xml
In this post
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/240339
By Lohitha .It's a link.
4.-Don't use liferay "Portlet Installer".
Use websphere admin console "update aplication Liferay".
Bye
hi mate,
ReplyDeletethanks for this comment.
i will try this methode this week.
thx greets marcel
I am looking for such type of informative news and i get through this blog so i am very much thankful to you for sharing such a great information.
ReplyDelete- liferay portlet
This was very useful and informative, This helps me very. Thanks for this exclusive blog
ReplyDelete