IBM Support

Upgrading to v6.0.1.2 results in error: portletRequest cannot be resolved

Question & Answer


Question

After upgrading to Rational Application Developer (RAD) or Rational Software Architect (RSA) version 6.0.1.2 in your simple Portlet Project you encounter an error message in the PortletView.jsp: "portletRequest cannot be resolved"

Answer

This error did not occur in RAD or RSA v6.0.1.1 and is a direct result of the upgrade.

This error does not affect the output of the portlet, and it will still run on the server without problems.

The available workaround is to wrap the portion of the jsp that has jsp scriptlet code that defines and uses the scripting variable (or at least as far as you need to use the variable) with a Start and End <portletAPI> tag.

For example, in the TestPortletView.jsp, instead of the default empty element tag <portletAPI:init /> at the top of the page, break up the tag to a start tag and end tag like <portletAPI:init> the rest of the jsp </portletAPI:init>. See below for a concrete example.

Broken version:

    <%@ page session="false" contentType="text/html" import="java.util.*, test.*"%>
    <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
    <portletAPI:init/>

    <%
    TestPortletSessionBean sessionBean = (TestPortletSessionBean)portletRequest.getPortletSession().getAttribute(TestPortlet.SESSION_BEAN);
    %>


Fixed version:
    <%@ page session="false" contentType="text/html" import="java.util.*, test.*"%>
    <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
    <portletAPI:init>

    <%
    TestPortletSessionBean sessionBean = (TestPortletSessionBean)portletRequest.getPortletSession().getAttribute(TestPortlet.SESSION_BEAN);
    %>

    <portletAPI:init/>


This is an Eclipse bug and was resolved in WTP 1.5.1, which is included in RAD and RSA version 7.0. See the Related information section for further details.

Related Information

[{"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Portal \/ Portlet Development","Platform":[{"code":"PF033","label":"Windows"}],"Version":"6.0.1.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Portal \/ Portlet Development","Platform":[{"code":"PF033","label":"Windows"}],"Version":"6.0.1.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
10 September 2020

UID

swg21288947