Forums de discussion

Liferay tag library in Alloy faces

Gautam Sharma, modifié il y a 7 années.

Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces (Réponse)

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
Thanks a lot for pointer however jar is present in classpath, Will check further what could be the issue.
thumbnail
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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
Juan Gonzalez, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces (Réponse)

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
Gautam Sharma, modifié il y a 7 années.

RE: Liferay tag library in Alloy faces

Junior Member Publications: 92 Date d'inscription: 30/04/12 Publications récentes
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.