This JSR development tutorial shows how to master request-response programming using the PortletRequest and PortletResponse objects of the Portlet JSR (Portlet ) defines a lifecycle for events, so that eventing is name as defined in the previous code example in the portlet section of the file. Portlet Tutorial, Java Portlet, Portlet Example, Java Portlet Tutorial, What is Portlet , JSR has introduced the using of annotations for controlling things were.
|Published (Last):||12 February 2017|
|PDF File Size:||15.96 Mb|
|ePub File Size:||13.18 Mb|
|Price:||Free* [*Free Regsitration Required]|
Web apps in Liferay Portal are called portlets. Like many web apps, portlets process requests and generate responses. In the response, the portlet returns content e. 268
One key difference is that portlets run in a portion of the web page. Another difference is that portlets run only in a portal server, like the one in Liferay Portal. In many ways, writing your application as a portlet is easier than writing a tuyorial application. Portlets can be placed on pages by users or portal administrators, who can place several different portlets on a single page.
For example, a page in a community site could have a calendar portlet for community events, an announcements portlet for important announcements, and a bookmarks portlet for links of interest to the community. And because the portal controls page layout, you can reposition and resize one or more portlets on a page without altering any portlet code.
Doing all this in other types of web apps would require manual re-coding. For example, a message boards or wiki portlet is best suited on its porglet page.
In short, portlets alleviate many of the traditional pain points associated with developing web apps. You can place multiple portlets on a single page. InJava Portlet Specification 1. InJava Portlet Specification 2. The recently released Java Portlet Specification 3.
Liferay leads in this space by portlft a member in the Expert Group. So what do these specifications define? We will tell you, however, how portlets differ from other types of servlet-based web apps.
Portlets handle requests in multiple phases. This makes portlets much more flexible than servlets.
Creating a simple portlet
Each portlet phase executes different operations:. Compared to servlets, portlets also have some other key differences. Portlets instead access a javax. The portlet specification only provides a mechanism for a portlet to read its own URL parameters or those tutroial as public render parameters. Liferay Portal does, however, provide 26 methods that can access the ServletRequest and query parameters.
Portlets also have a portlet filter available for each phase in the portlet lifecycle. Portlet filters are similar to servlet filters in that they allow request and response modification on the fly. Portlets also differ from servlets by having distinct modes and window states. Portlet window states control the amount of space a portlet takes up on a page.
Window states mimic window behavior in a traditional desktop environment:. When you develop portlets for Liferay Portal, you can leverage all the features defined by the portlet specification. Depending on how you develop and package your portlet, however, it may not be able to run on other portal containers.
I thought Liferay Portal was standards-compliant? For example, you can develop your portlet with strictly standards-compliant frameworks and APIs, package it in a WAR file, and then deploy it on any standards-compliant portal container. Liferay Portal also contains an OSGi runtime.
We recommend the latter, so you can take advantage of the modularity features inherent in OSGi. For a detailed description of these features, see the tutorial OSGi and Modularity.
Creating a simple portlet
Even so, the advantages of modularity are so great that we still recommend you develop your portlets as OSGi modules. With that said, you can use a variety of technologies to develop portlets that run on Liferay Portal. This section shows you how to develop portlets using the following frameworks and techniques:. This gives you access to all the MVC Portlet functionality you are familiar with, plus the added bonus of using Soy templates for Liferay is an open platform in an ecosystem of open platforms.
It is perfectly valid to bring the tools Do you want to use a portlet development framework with a UI component model that makes it easy to develop sophisticated, rich One was full of himself, and always wanted to show everyone users and SEO services alike just how smart he was, by openly displaying Do you wish you could use npm and npm packages in your portlets?
A good user experience is the measure of a well-designed site.
The last thing you want is for someone to grow frustrated with your site because of constant page Page layout tags let you create layouts using Bootstrap 3 within your portlets.
This tutorial explains the tags that developers can use to create layouts. Each portlet phase executes different operations: When this phase runs on one portlet, it also runs on all other portlets on the page. The Render phase runs portelt any portlets on the page complete the Action or Event phases. The Action phase can also trigger events that are processed by the Event phase.
Processes events triggered in the Action phase. Events are used for IPC. Once the portlet processes all events, the portal calls the Render phase on all portlets on the page.
Serves a resource independent from the rest of the lifecycle. This lets a portlet serve dynamic content without running the Render phase on all portlets on a page. Use this mode to configure a custom view or behavior. For example, the Edit mode of a weather portlet could let you choose a location tutoria, retrieve weather data from.
Most modern applications use View Mode only. Window states mimic window behavior in a traditional desktop environment: The portlet can be on a page that contains other portlets. This is the default window state. The portlet takes up an entire page. This section shows you tuforial to develop portlets using the following frameworks and techniques: