Your SlideShare is downloading. ×

JSP Portlet

7,023
views

Published on

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,023
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
126
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Basic Portlet
  • 2. Objectives
    • The goal of this tutorial is to create a JSP portlet
    • Define the portlet portlet-ext.xml liferay-portlet-ext.xml
    • Create the JSP view.jsp
  • 3. Directory Structure
    • Configuration files are located here: extext-webdocrootWEB-INF
    • JSPs are located here: extext-webdocroothtml
  • 4. Define the Portlet
    • The first step will be to define the portlet in portlet-ext.xml
    • The second step will be to define the portlet in liferay-portlet-ext.xml
  • 5. portlet-ext.xml
    • <portlet>
    • <portlet-name>EXT_2</portlet-name>
    • <display-name>JSP Portlet Introduction</display-name>
    • <portlet-class>com.liferay.portlet.JSPPortlet</portlet-class>
    • <init-param>
    • <name>view-jsp</name>
    • <value>/portlet/ext/jsp_portlet/view.jsp</value>
    • </init-param>
    • <expiration-cache>0</expiration-cache>
  • 6. portlet-ext.xml
    • <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>
  • 7. liferay-portlet-ext.xml
    • The second step is to define the portlet in liferay-portlet-ext.xml
    • <portlet>
    • <portlet-name>EXT_2</portlet-name>
    • </portlet>
  • 8. view.jsp
    • Create the following directory structure: extext-webdocroothtmlportletextjsp_portlet
    • Create view.jsp extext-webdocroothtmlportletextjsp_portlet view.jsp
    • Enter the following in view.jsp JSP Portlet!
  • 9. Change Title and Add to Category
    • Set the Title Language-ext.properties
    • Add the portlet to a Category liferay-display.xml
  • 10. Directory Structure
    • Configuration files are located here: extext-webdocrootWEB-INF
    • Property files are located here: extext-ejbclasses
  • 11. Language-ext.properties
    • The first step is to change the Title from javax.portlet.title.EXT_2 to JSP Portlet!
    • Go to extext-ejbclassescontent Language-ext.properties
    • Enter the following in Language-ext.properties: javax.portlet.title.EXT_2=JSP Portlet!
  • 12. liferay-display.xml
    • Next, let’s add our portlet to the Test Category
    • Go to extext-webdocrootWEB-INF liferay-display.xml
    • Enter the following in liferay-display.xml: <category name=&quot;category.test&quot;> <portlet id=“47” /> … <portlet id=&quot;EXT_1&quot; /> <portlet id=&quot;EXT_2&quot; /> </category>
  • 13. Deploy to Tomcat
    • Click Start  Run…
    • Type cmd and press Enter
    • Navigate to C:Trainingliferayext
    • Type ant deploy
  • 14. Final Steps
    • Restart Tomcat: Click on the Tomcat Window Press Ctrl-C Double click startup.bat
    • Open up a new browser and type http://localhost:8080 Login: test@liferay.com Password: test
    • Click Add Content  Test
    • Click EXT_2

×