Monday, December 23, 2013

OpenPortal - Calling JSP from a Portlet

I recently got stuck on Chapter 3 of Cameron McKenzie's Portlet Programming book.  Since it took me a while to figure this out and because I wasn't able to find anything of much help online, I thought I'd share what I did.

Note: The following solution was tested on GlassFish 4 using the OpenPortal Portlet Container.

Basically I needed to modify the web.xml file to the following:
<?xml version = "1.0" encoding = "UTF-8"?>
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
<web-app id="WebApp_ID">

  <taglib id="PortletTLD">

The above code was derived from page 54 of Cameron McKenzie's book.  Cameron, however, used /WEB-INF/tld/std-portlet.tld as the body of the taglib-location element.  That is, in Cameron's book this is what he has:
I obtained the sun-portlet.tld file from OpenPortal's sample portlet project, WelcomePortlet. 

Note: You'll also need to add the portlet.jar and portlet-container.jar to the build path.

No comments:

Post a Comment