掲示板

Liferay tag library in Alloy faces

7年前 に Gautam Sharma によって更新されました。

Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Hi,

I am new to liferay faces and trying to show webcontent in portlet.
I tried using <liferay-ui> tag library in xhtml file (where xmlns:liferay-ui="http://liferay.com/faces/ui ") but its showing below error. Not sure whether we can use liferay tag libraries in .xhtml file or not.
java.lang.NullPointerException: Argument Error: Parameter url is null


I further tried to achieve same thing using managed bean and set the content in one the variable but still its not showing on UI using <alloy:outputText> tag

<alloy:outputtext value="#{navigationController.content}" />


Adding to this if try without any tag and directly put
#{navigationController.content}
in .xhtml file, it does print the content but encode it automatcially and due to this i am not able to show html content.

Any help would be much appreciated

Note : Content is having html string.

Environment :
JSF : 2.1
Liferay faces alloy : 3.2.4-ga5
Liferay 6.2 EE
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Hi Gautam.

Can you show the snippet when you where using liferay-ui, I can't see your purpose on using this tag.

Other question, does that webcontent come from Liferay? I mean, is that content a Journal article?

Thanks.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Hi Juan,

Thanks for prompt response.Please find details.

1. Can you show the snippet when you where using liferay-ui, I can't see your purpose on using this tag.
Code Snippet:

     <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:alloy="http://liferay.com/faces/alloy" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:portal="http://liferay.com/faces/portal" xmlns:liferay-ui="http://liferay.com/faces/ui">
   <liferay-ui:journal-article showTitle="false" articleId="#{navigationController.articleId}" /></f:view>


2. Other question, does that webcontent come from Liferay? I mean, is that content a Journal article
Yes it is.
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Gautam Sharma
     <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:alloy="http://liferay.com/faces/alloy" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:portal="http://liferay.com/faces/portal" xmlns:liferay-ui="http://liferay.com/faces/ui">
   <liferay-ui:journal-article showTitle="false" articleId="#{navigationController.articleId}" /></f:view>



There is no Liferay Faces journal-article tag, that's why isn't working for you.

Gautam Sharma
2. Other question, does that webcontent come from Liferay? I mean, is that content a Journal article
Yes it is.


Ok, in that case please see this code example on how to render journal articles in multiple instances:

https://github.com/liferay/liferay-faces/blob/master/demos/showcase/showcase-portlet/src/main/webapp/WEB-INF/component/portal/runtime/multiple-instances/runtime.xhtml.

Here you have how to get the preferences for those articles:

https://github.com/liferay/liferay-faces/blob/master/demos/showcase/showcase-portlet/src/main/java/com/liferay/faces/demos/bean/RuntimeBacking.java

BTW. it's recommended for you to upgrade to the new Liferay Faces version. Checkout this page: liferayfaces.org where you can generate Maven dependencies for your environment. In that case remember to undeploy your previous portlet so jar libraries are totally new and don't conflict with previous version.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
HI Juan,

Thanks Again.I will give it a try.

However can you please help me understand why it is not working using managed bean as I can see content is getting generated properly and i can print using #{navigationController.content} but it escape html characters.

Moreover i can't print using <alloy:outputText value="#{navigationController.content}" />

Can you please help me in this and share some reference link where i can see what are available options for <liferay-ui> tag for faces.

Thanks
Gautam
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Gautam Sharma:

However can you please help me understand why it is not working using managed bean as I can see content is getting generated properly and i can print using #{navigationController.content} but it escape html characters.


Just use
escape="false"
in order to render HTML unescaped directly (more info: https://javaserverfaces.java.net/nonav/docs/2.2/vdldocs/facelets/h/outputText.html, as alloy:outputText extends h:outputText).

Gautam Sharma:

Can you please help me in this and share some reference link where i can see what are available options for <liferay-ui> tag for faces.


Here you are: https://github.com/liferay/liferay-faces/tree/3.2.x/portal/src/main/resources/META-INF/resources/liferay-ui, BUT take into account these components are legacy and we probably could not help if you find any bug there.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Hi Juan,

I tried that option already but no luck.Please suggest.

Actual Code:
<alloy:outputtext value="#{navigationController.content}" escape="false" />


After page render:
<alloy:outputtext value="<h2>Hello World</h2>" escape="false"></alloy:outputtext>


Thanks
Gautam
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces (回答)

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Gautam Sharma:
Hi Juan,

I tried that option already but no luck.Please suggest.

Actual Code:
<alloy:outputtext value="#{navigationController.content}" escape="false" />


After page render:
<alloy:outputtext value="<h2>Hello World</h2>" escape="false"></alloy:outputtext>


Thanks
Gautam


If
<alloy:outputtext></alloy:outputtext>
is rendered, that means one of these possible problems:

1) liferay-faces-alloy dependency wasn't added in your project, so alloy jar file isn't added in your portlet.
2) alloy namespace was declared wrong in your xhtml, but as the snipped you pasted before, seems this is right.
3) alloy:outputText doesn't exist. In this case, if you used alloy:outputText (with that camel case) seems it's fine.

So I think option 1) is the culprit here.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Thanks a lot for pointer however jar is present in classpath, Will check further what could be the issue.
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
I encourage you to create a new project using the archetype you can find here: liferayfaces.org
and re-check this again.

we will assist you here if you find any problem.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Thanks a lot for your help Juan,Really appreciate.

Adding to this we are using iplugin SDK instead of maven for creating plugins and some more information related to environment

Plugin sdk : liferay-plugins-sdk-6.2-ee-sp10
Portal : liferay-portal-6.2-ee-sp10 (tomcat Bundle)

Jar files:

jboss-el.jar
jsf-api.jar Version : 2.1
jsf-impl.jar 2.1.21
liferay-faces-alloy.jar 3.2.4-ga5
liferay-faces-bridge-api.jar 3.2.4-ga5
liferay-faces-bridge-impl.jar 3.2.4-ga5
liferay-faces-portal.jar 3.2.4-ga5
liferay-faces-util.jar 3.2.4-ga5

Thanks
Gautam
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay tag library in Alloy faces (回答)

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Gautam Sharma:
Thanks a lot for your help Juan,Really appreciate.

Adding to this we are using iplugin SDK instead of maven for creating plugins and some more information related to environment

Plugin sdk : liferay-plugins-sdk-6.2-ee-sp10
Portal : liferay-portal-6.2-ee-sp10 (tomcat Bundle)

Jar files:

jboss-el.jar
jsf-api.jar Version : 2.1
jsf-impl.jar 2.1.21
liferay-faces-alloy.jar 3.2.4-ga5
liferay-faces-bridge-api.jar 3.2.4-ga5
liferay-faces-bridge-impl.jar 3.2.4-ga5
liferay-faces-portal.jar 3.2.4-ga5
liferay-faces-util.jar 3.2.4-ga5

Thanks
Gautam


In order to have alloy:outputText you should at least upgrade to 3.2.5-ga6.

Anyway, I insist you better upgrade to the latest version to have a better and supported version.

Thanks.
7年前 に Gautam Sharma によって更新されました。

RE: Liferay tag library in Alloy faces

Junior Member 投稿: 92 参加年月日: 12/04/30 最新の投稿
Many Thanks emoticon

Yes i did check the jar file and found out alloy.taglib.xml file is missing in liferay-faces-alloy.jar 3.2.4-ga5 file which has support for outputText.

And Will definitely consider upgrade suggestion if it doesn't have major impact on existing deployed module.