Chapter 6. Using the portlet tag library

 

This chapter covers

  • Accessing portlet objects in JSPs
  • Creating portlet URLs in JSPs
  • Creating portlet-specific HTML elements

Having read the past five chapters and learned the basics of working with portlets, you may be wondering if there’s an easy way to create portlet URLs or to access portlet API objects in JSP. Well, you’re about to find out.

In previous chapters, you used JSP as the view technology for displaying portlet content. In servlet-based web applications, JSPs included or forwarded by servlets have access to certain implicit variables like request, session, and so on. You used these in the Book Catalog portlet to display user information (like the name of the logged-in user) and the book catalog. You also created render and action URLs programmatically in the portlet’s render method by using the RenderResponse object.

The portlet tag library is a set of tags that provide included and forwarded JSPs with access to portlet-specific objects (such as RenderRequest, RenderResponse, and PortletSession) and it also makes it simpler for JSPs to create portlet URLs. In this chapter, we’ll discuss the portlet tag library tags, their attributes, and their usage in developing portlets. You’ll rebuild the Book Catalog portlet so that it uses portlet tag library tags.

We’ll look at the following tags and their attributes:

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 <param>

6.5. Creating portlet-specific HTML elements using <namespace>

6.6. Adding properties to URLs using <property>

6.7. Summary

sitemap