In this three-part series, the articles describe new features available in the Java Portlet Specification (JSR ) and extensions supported by OpenPortal. This JSR Portlet Development Tutorial and Technology Guide is designed to help enterprise Java professionals gain the knowledge they need to excel in the emerging portal and portlet development space. A short article appeared in April of on TheServerSide that discussed. This portlet programming tutorial is an introduction to developing JSR applications that can be deployed to any standards-based portal server. Portlets are, quite simply, standardized, Java-based, content delivery vehicles that render themselves within the confines of a portal.

Jsr 286 Tutorial Download

Language:English, French, Japanese
Genre:Personal Growth
Published (Last):18.09.2016
ePub File Size:25.73 MB
PDF File Size:18.16 MB
Distribution:Free* [*Sign up for free]
Uploaded by: ALYSON

Developing JSR Portlets Cris J. Holdorph Unicon, Inc. JA-SIG . Portlet / JSR History Java Community Process. Portlet Tutorial, Java Portlet, Portlet Example, Java Portlet Tutorial, What is JSR has introduced the using of annotations for controlling things .. Contribute us by commenting below and find downloaded source code. Liferay Portal Portlet tutorial for beginners, liferay download, liferay eclipse plugin example, liferay Liferary is a JSR complaint leading Portlet container.

Only one,short title per locale is allowed. The display name need,not be unique. Typically, you should define your resources within the same package as your Portlet to make sure every Portlet has used its relevant messages.

Another way to change the title programmatically, you can invoke setTitle against renderResponse object inside any delegated method i. These actions URLs are useful for processing actions i. At the same time, some Portlets have provided so complicated business, the user may need some sort of help to get the Portlet working properly and for that purpose the doHelp is given.

Other two Portlets have defined all of modes are available.

Portal provides you the mode user interface for toggling between modes that are supported by the Portlet. Summary Portlet specification provide vast amount of APIs that you have to learn to be Portlet developer. Portlets are not JavaBeans.

Portlets are, quite simply, standardized, Java-based, content delivery vehicles that render themselves within the confines of a portal page. Note: The fact that portlets are rendered within the confines of a portal page is not a minor point. When a portlet renders itself, the content it generates only constitutes a portion of the total content delivered to the end user.

A portlet may make up a large portion of the overall content delivered to a handheld device, or it may make up a quarter of the HTML page delivered to a client's Web browser; but regardless of how much of the total content delivered to an end user for which a given portlet is responsible, the fact remains that a portlet only generates part of the total amount of content delivered to the end user.

The portion of content a portlet generates for rendering is typically referred to as a fragment. The mighty portlet interface From the standpoint of an application developer, a portlet is any Java class that implements the javax.

Portlet interface. Like a servlet, a portlet is a shy and reserved little creature that lives peacefully in a WAR file Web Application aRchive.

JSR-286 development tutorial: An introduction to portlet programming

However, if you get a few drinks into a portlet and get it loaded, that little portlet remains loaded in memory forever, and it is not unloaded until the portal server shuts down or the administrator explicitly takes the portlet out of service.

Once loaded, the single portlet instance can respond, in a threaded fashion, to an unlimited number of client requests, with the only restraint being the hardware limitations of the portal server on which it runs. Figure 1. The Portlet interface and the methods it defines.

Java Portlet Example Tutorial

Lifecycle methods of the Portlet interface The javax. Portlet interface defines four lifecycle methods, with the init and destroy methods used to allow a developer to take action when a portlet is first loaded, or when a portlet is unloaded by the portal server. Similar to the Servlet and JSP API, the method corresponding to a portlet's initialization is very uncreatively named init PortletConfig config , and the method that maps to the unloading of a portlet is violently named destroy.

The very generic portlet interface also defines two more very important lifecycle methods, namely the processAction method, which logically is intended to be used during the action-processing phase, and the render method, which as you could probably guess, corresponds to the rendering phase in which a portlet generates the markup fragment that eventually gets displayed back to the client. The abstract class GenericPortlet As a JSR portlet developer , you will never create a class that simply implements the portlet interface.

Okay, maybe never is a little bit of an exaggeration, but when you code your portlets, you don't implement the portlet interface directly, but you extend the abstract class GenericPortlet instead, which itself implements the javax. These methods correspond to the three standard rendering modes of a portlet.

Clever, eh? Figure 2.

The methods of the GenericPortlet class. What do portlets do? Okay, so far we've discussed what a portlet is. In so doing, we have covered the mind-numbing details of the portlet interface and the abstract GenericPortlet class. That describes what a portlet is. But as developers, we are more concerned with what a portlet does, and more to the point, how it does it. At the most fundamental level, portlets are simply presentation-tier components that handle a request-response cycle.

When a request comes in from a client, portlets are responsible for inspecting that request, and figuring out exactly what the client is requesting.

Once the portlet has figured out what the crazy client is requesting, the portlet must then figure out how to respond. Before responding to a client, a portlet might use a bunch of EJBs or JavaBeans , Web services or JDBC, but eventually, a response must be formulated and sent back to the portal for portal page aggregation, after which content is finally returned to the client.

The essence of portlet programming is handling the request-response cycle. Conquer the request-response cycle, and the rest of the Portlet API will easily fall under your control. Figure 3. The ancestry and the implemented interfaces of a custom portlet.

Liferay Tutorial – Liferay Portal Portlet Tutorial

The most basic portlet In the most basic sense, a portlet simply handles a Web-based, request-response cycle. Figure 1. Sample Application: Eventing Map Using Wildcards To use wildcards, the portlet must organize the local part of the event names in the event-definition element in a hierarchical manner using the dot.

For example: foo. If you want the wildcard string to match a part of a hierarchy, two dots are required at the end of the wildcard string: one to denote the hierarchy and one for the wildcard. For example: foo.. The event name must be part of the hierarchy, not a substring. Portlet2 can process the events x:foo.

Portlet3 can process the events x:foo.

Continue Reading This Article

Portlet4 cannot process any event because there is no event that begins with the hierarchy x:foo. Note: e.

Using Aliases Aliases can be used to coordinate between two portlet applications that use different event names. Consider a portlet, PortletA, that uses lastname as an event name and a portlet, PortletB, that uses surname as an event name. The event published by PortletA cannot be processed by PortletB because the event names are different. By adding alias in the portlet. To add aliases for portlet events: Add an alias the same as qname of the event of PortletB in the portlet.

By using the public render parameters feature, the render parameters set in the processAction method of one portlet are available in render parameters of the other portlets. Using public render parameters instead of events avoids the additional process event call. The public render parameters can also be set on the render URL.

To enable coordination of render parameters with other portlets within the same portlet application or across portlet applications, the portlet can declare public render parameters in its deployment descriptor using the public-render-parameter element in the portlet application section. Public render parameters can be viewed and changed by other portlets or components.

In the portlet section, each portlet can specify the public render parameters to be shared through the supported-public-render-parameter element. The supported-public-render-parameter element must reference the identifier of a public render parameter defined in the portlet application section in a public-render-parameter element.

To create portlets that use the public render parameters: Declare the render parameters to be shared in the portlet.Browsing of your dashboard will make you able of adding, removing and modifying your Portlets. The junk we output appears within the confines of a portlet window, on a portal page. Let us know. That lets you creating a Liferay Portlet as a Liferay Plugin.

The essence of portlet programming is handling the request-response cycle.

Monday, January 07, 2008

To add aliases for portlet events: Add an alias the same as qname of the event of PortletB in the portlet. This tutorial is intended to provide you a full detailed explanation for getting Liferay Portal up and running and deploy the same employee registration sample that we had developed in earlier tutorial. An event is a lifecycle operation that occurs before the rendering phase.

Follow: JSR portlet development tutorial and technology guide This JSR Portlet Development Tutorial and Technology Guide is designed to help enterprise Java professionals gain the knowledge they need to excel in the emerging portal and portlet development space.