Laliwala IT Services

Laliwala IT Services
Website Development

Friday, March 25, 2011

liferay tutorial, simple jsp portlet, basic jsp, portlet

Code Snippets for various examples.

Prepared by Aasif and Ahmed under the guidance of Irshad Mansuri

Attune Infocom pvt. ltd.
----------------------------------------------------------------------------------

===============================================================
1.Basic JSP Portlet
===============================================================

[the xml files are located under "ext/ext-web/docroot/WEB-INF"]

1.1. portlet-ext.xml
--------------------

(insert the below content)

<portlet>
<portlet-name>EXT_2</portlet-name>
<display-name>JSP Portlet Introduction</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>
<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>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>

1.2. liferay-portlet-ext.xml
----------------------------

(insert the below content)

<portlet>
<portlet-name>EXT_2</portlet-name>
</portlet>


1.3. liferay-display.xml
------------------------

(insert the below content)

<category name="category.example">
<portlet id="EXT_2" />
</category>

1.4. view.jsp
-------------

(create this file under "ext/ext-web/docroot/html/portlet/ext/jsp_portlet"
and enter the below contents)

Welcome to simple Basic JSP Portlet

Note: after this step do "ant deploy" from "ext-web"

1.5 Language-ext.properties
---------------------------

(under /ext/ext-impl/src/content)

Add two new entries in the above file,

javax.portlet.title.EXT_2=JSP Portlet

category.example=Training

Note: after this step do "ant deploy" from "ext-impl"

1.6 Restart the server and check
--------------------------------

Restart the server and check you get the new portlet under the "Training" category








Goto to Add application




See new category Training is made under which there is newly created JSP portlet.






JSP Portlet is successfully added.



No comments:

Post a Comment