How to use the Portlet Specification 2.0 Tag library in WebSphere Portal 6.1

If your building a JSR 286 compliant portlet and want to use one of the new tags introduced in JSR 286 such as resourceURL then you will have to include the http://java.sun.com/portlet_2_0 tag library in your JSP like this


<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />
<a href='<portlet:resourceURL />'>Resource URL </a>


By default when you create a portlet JSP in RAD 7.5 it always adds Portlet Specification 1.0 related tag library like this <%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%> and with this you cannot use newer tags

1 comment:

andy said...

Thanks Sunil, this was a nice pointer...