Chapter 2. The portlet lifecycle
This chapter covers
- Creating portlet URLs
- Portlet lifecycle management
- Portlet content generation using JSPs and servlets
- Commonly used Portlet API classes and interfaces
In chapter 1 you saw the steps required to develop, build, and deploy a simple Hello World portlet. Understanding the portlet lifecycle is important for effectively using portlets in your portlet applications.
This chapter introduces the portlet lifecycle and some of the core concepts of Java portlet technology. We’ll first look at the requirements for an example User Registration portlet that you’ll develop using the concepts discussed in this chapter. The concept of portlet URLs is at the heart of portlet technology, so before discussing the lifecycle of a portlet, we’ll take a quick look at what portlet URLs are and what they’re used for. The rest of this chapter focuses on the portlet lifecycle, initialization parameters, portlet URLs, portlet modes, portlet context, portlet configuration, localization, container-runtime options, and how to use JSP pages to render portlet content. We’ll conclude this chapter by discussing how the User Registration portlet is implemented.
Code Reference
The source code for this chapter is located in the ch2_UserRegistration folder. Before you build the User Registration project, set the liferay.portal.home property in the build.properties file to point to your Liferay Portal installation directory.