Portlets in Action
Ashish Sarin
  • September 2011
  • ISBN 9781935182542
  • 640 pages
  • printed in black & white

An essential handbook.

Doug Warren, Java Web Services

Portlets in Action is a comprehensive, hands-on guide to building portlet-driven applications in Java. Covers Portlet 2.0, Spring 3.0 Portlet MVC, WSRP 2.0, Portlet Bridges, Ajax, Comet, Liferay, GateIn, Spring JDBC, and Hibernate.

Table of Contents detailed table of contents


acknowledgments about this book about the cover illustration




Part 1 Getting started with portlet development

1. Chapter 1 Introducing portals and portlets

1.1. What is a portal?

1.2. Benefits of web portals

1.3. What is a portlet?

1.4. Why use portlets?

1.5. Portal infrastructure

1.6. Getting started with Liferay Portal

1.7. Setting up the development environment

1.8. The Hello World portlet example

1.9. Summary

2. Chapter 2 The portlet lifecycle

2.1. Requirements for the User Registration portlet

2.2. Portlets vs. servlets—an in-depth look

2.3. Portlet URLs

2.4. Creating portlets

2.5. Generating portlet content based on portlet mode

2.6. Portlet development in depth

2.7. Implementing the User Registration portlet

2.8. Summary

3. Chapter 3 Portlet 2.0 API—portlet objects and container-runtime options

3.1. Requirements for the Book Catalog portlet

3.2. Portlet request objects

3.3. Portlet response objects

3.4. Storing user-specific data in a portlet session

3.5. Discovering the portlet environment using PortletContext

3.6. Retrieving portlet configuration using PortletConfig

3.7. Container-runtime options

3.8. Summary

4. Chapter 4 Portlet 2.0—API caching, security, and localization

4.1. Caching generated content

4.2. Localizing portlet content

4.3. Portlet modes in depth

4.4. Portlet window states in depth

4.5. Programmatic security

4.6. Uploading files, wrapping requests and responses, and creating portlet URL generation listeners

4.7. Designing portable portlets

4.8. Summary

5. Chapter 5 Building your own portal

5.1. Requirements for Book Portal

5.2. Getting started developing Book Portal

5.3. Creating portal pages and adding portlets

5.4. Configuring Liferay Portal server settings

5.5. Developing with the Liferay Plugins SDK

5.6. Summary

6. Chapter 6 Using the portlet tag library

6.1. Using the tag library to build a Book Catalog portlet

6.2. Accessing portlet-specific objects using <defineObjects>

6.3. Using <actionURL>, <renderURL>, and <resourceURL>

6.4. Adding parameters to portlet URLs using

6.5. Creating portlet-specific HTML elements using

6.6. Adding properties to URLs using

6.7. Summary

Part 2 Developing portlets using Spring and Hibernate

7. Chapter 7 Getting started with Spring Portlet MVC

7.1. Why use Spring Portlet MVC?

7.2. Dependency injection and the application context

7.3. A Hello World portlet, the Spring way

7.4. How Spring Portlet MVC works

7.5. Using DispatcherPortlet

7.6. Using the web application context

7.7. Using built-in controllers

7.8. Using built-in handler mappings

7.9. Using handler interceptors

7.10. Handling exceptions

7.11. Summary

8. Chapter 8 Annotation-driven development with Spring

8.1. An overview of annotations

8.2. Developing the Book Catalog portlet using annotations

8.3. Spring Portlet MVC annotations

8.4. Configuring beans that provide annotation support

8.5. Validating forms using Spring and JSR 303

8.6. Spring’s form tag library

8.7. Unit testing with mock objects and TestContext

8.8. Localizing content, uploading files, and adding CSS and JavaScript

8.9. Summary

9. Chapter 9 Integrating portlets with databases

9.1. Combining portlets and databases

9.2. Exploring the Book Catalog portlet’s database tables

9.3. Spring’s JDBC module for database interaction

9.4. Accessing Spring beans from non-Spring objects

9.5. AOP support in Spring Framework

9.6. Transaction management support in Spring Framework

9.7. Using Hibernate for database interaction

9.8. Summary

Part 3 Advanced portlet development

10. Chapter 10 Personalizing portlets

10.1. Introducing portlet personalization

10.2. Personalization requirements for the Book Catalog portlet

10.3. Showing personalization options in EDIT mode

10.4. Saving user preferences

10.5. Saving preferences with PortletPreferences

10.6. Validating preferences

10.7. Retrieving portlet preferences and personalizing the portlet

10.8. Summary

11. Chapter 11 Communicating with other portlets

11.1. Why do you need inter-portlet communication?

11.2. An inter-portlet communication example

11.3. Inter-portlet communication using portlet sessions

11.4. Inter-portlet communication using public render parameters

11.5. Inter-portlet communication using portlet events

11.6. Summary

12. Chapter 12 Ajaxing portlets

12.1. Ajax basics

12.2. Your first Ajax portlet

12.3. Securing Ajax requests

12.4. Ajax support in Portlet 2.0

12.5. Downloading binary content using portlets

12.6. Resource URLs and caching

12.7. Creating a rich interface for the Book Catalog portlet

12.8. Creating rich user interfaces using Ajax

12.9. Creating real-time portlets using Polling and Comet

12.10. Cross-domain Ajax

12.11. Ajax and inter-portlet communication

12.12. Summary

13. Chapter 13 Reusable logic with portlet filters

13.1. Types of portlet filters

13.2. Portlet filter interface methods and lifecycle

13.3. Using portlet filters with the Book Catalog portlet

13.4. Setting the portlet title with the portlet filter

13.5. Validating requests with portlet filters

13.7. Filter chaining

13.8. Summary

14. Chapter 14 Portlet bridges

14.1. What is a portlet bridge?

14.2. iFrame portlets

14.3. JSF portlets

14.4. Wicket portlets

14.5. Summary

15. Chapter 15 Web Services for Remote Portlets (WSRP)

15.1. What makes remote portlets a reality?

15.2. Getting started with WSRP using Liferay Portal

15.3. Creating a WSRP producer and adding portlets to it

15.4. Creating a WSRP consumer

15.5. Locally registering remote portlets

15.6. Registering WSRP consumers with WSRP producers

15.7. Summary

© 2014 Manning Publications Co.

About the Technology

Portlets are the small Java applications that run within a portal. Good portlets work independently and also communicate fluently with the portal, other portlets, as well as outside servers and information sources. Using Java's Portlet 2.0 API and portal servers like Liferay, you can build flexible, stable business portals without the design overhead required by other application styles.

About the book

Portlets in Action is a comprehensive guide to building portlet-driven applications in Java. It teaches portlet development hands-on as you develop a portal that incorporates most key features of the Portlet 2.0 API. And because portals and portlets are so flexible, the accompanying source code can be easily adapted and reused. Along the way, you'll learn how to work with key web frameworks like Spring 3.0 Portlet MVC and DWR.

What's inside

  • Complete coverage of the Portlet 2.0 API
  • Spring 3.0 Portlet MVC and the Liferay portal server
  • Portal design best practices
  • Reusable source code

About the reader

Written for Java developers. No prior experience with portlets required.

About the author

Ashish Sarin has over 12 years of experience designing and developing web applications and portals using Java EE and portlet APIs.

  • combo $49.99 pBook + eBook
  • eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Best coverage of Spring Portlet MVC anywhere.

Lester Martin, Hewlett-Packard

An invaluable resource...hands-on examples.

Barbara Regan, Centra Technology

Finally, a good book on JSR 286, also featuring Spring MVC & Ajax.

Jakub Holy, Iterate AS

Quickly extend your Java and Spring skills into portlet development.

Joshua White, Independent Consultant