Message Boards

Liferay Faces - portlet:DefineObjects tag is no longer supported

Vincenzo Malagrinò, modified 3 Years ago.

Liferay Faces - portlet:DefineObjects tag is no longer supported

New Member Posts: 3 Join Date: 11/5/20 Recent Posts


Hello people!

I'm upgrading a portlet with xhtml files instead of jsp files from 6.2 to 7.2 liferay version. Requirements are that migrated portlet continues to work with xhtml files. I have already updated com.liferay.faces dependencies, particularly liferay-faces-bridge-impl to com.liferay.faces.bridge.impl.

Now in a xhtml file there is the <portlet:defineObjects /> tag.

This tag, I saw into com.liferay.faces.bridge.impl.jar's portlet.taglib.xml, is no longer present. In fact when I deploy the portlet I get this error: "Tag library supports namespace http://java.sun.com/portlet_2_0 but no tag was defined for name defineObjects". How can I solve this issue? Is it safe to remove <porlet:defineObjects/> with no other edit?

For completeness this is the dependency into pom.xml

<dependency>
    <groupId>com.liferay.faces</groupId>
    <artifactId>com.liferay.faces.bridge.impl</artifactId>
    <scope>runtime</scope>
</dependency>

And this is the snippet of the involved xhtml file

<?xml version="1.0" encoding="UTF-8"?>
<f:view
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:alloy="http://liferay.com/faces/alloy"
    xmlns:p="http://primefaces.org/ui"
    xmlns:liferay-ui="http://liferay.com/tld/ui"
    xmlns:portlet="http://java.sun.com/portlet_2_0"
    xmlns:bridge="http://liferay.com/faces/bridge">

    <h:head />

    <portlet:defineObjects/>
    <f:event listener="#{bean1.onPageRender}" type="preRenderView" />

    <h:body>
      <alloy:row>
        <alloy:column>
          <h:form>
            <p:messages autoUpdate="true" />
            <alloy:fieldset>
              <alloy:row>
                <alloy:column>
                  <alloy:field label="visible">
                    <p:inputTextarea value="#{bean2.visible}" />
                  </alloy:field>
                </alloy:column>
              </alloy:row>
            </alloy:fieldset>

            <p:commandButton action="#{bean1.submit}" value="Save" />
          </h:form>
        </alloy:column>
      </alloy:row>
    </h:body>
</f:view>

Thank you.


 

thumbnail
Neil Griffin, modified 3 Years ago.

RE: Liferay Faces - portlet:DefineObjects tag is no longer supported (Answer)

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts

Hi Vincenzo,

Thanks for asking this question. I would recommend that you read Section 6.5 of the JSR 378 Specification titled "Expression Language Resolution" to get a good understanding of this topic.

To make a long story short, you should be able to simply delete the <portlet:defineObjects/> tag from the XHTML file, because most (if not all) of the objects that you would need are introduced by the bridge's ELResolver, which is used by Facelets when resolving EL Expressions.

Kind Regards,

Neil