Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Liferay Faces - portlet:DefineObjects tag is no longer supported
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.
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
Powered by Liferay™