This blog entry will provide you an example how to create a simple jsp portlet in liferay.
Following are the simple steps for creating customize portlet in liferay.
I am assuming that you have set up an ext environment properly under you IDE if not please go liferay throuh wiki or just leave comment
configuration files required for creating jsp portlet are ..
1. portlet-ext.xml
2. liferay-portlet-ext.xml
3. liferay-display.xml
the above file are present under directory
“ext/ext-web/docroot/WEB-INF”.
write following snippet of code under portlet-ext.xml
<portlet>
<portlet-name>EXT_1</portlet-name>
<display-name>FirstJspPortlet</display-name>
<portlet-class>com.liferay.util.bridges.jsp.JSPPortlet</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/html/portlet/ext/jsp_portlet/view.jsp</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
your liferay-portlet-ext.xml should be as..
<portlet>
<portlet-name>EXT_1</portlet-name>
</portlet>
3} under liferay-display.xml
<category name=”category.firstJSP”>
<portlet id=”EXT_1″ />
</category>
Dat’s hit for configuration files now for front end create a file view.jsp under directory structure
“ext/ext-web/docroot/html/portlet/ext/jsp_portlet”
with simple gretings
<h1>Hello Liferay World</h1>
now go the file structure
ext/ext-impl/src/content
and add this new entries in file
javax.portlet.title.EXT_1=JSP Portlet
category.firstJSP=First Portlet
and dats hit for creating a simple jsp portlet
After this steps do “ant deploy” from “ext”.
You will be getting the message “BUILD SUCCESSFUL”. // if this is done you will bw delighted
Now start your server and login as admin (test user by default),
go to the navigation dock->Add Aplication-> First Portlet->JSP Portlet.
cheers……..
Nishikant Sapkal.
opensource Team,
Zensar Technologies,
Pune.