IceFaces and PrimeFaces portlets on the same Liferay page - jsf

I have portlets written on IceFaces 1.8.2.
Since I found PrimeFaces better I decided to write my new portlet with JSF2 and PrimeFaces 3.5.
Separately everything is working. But when I'm trying to put my PrimeFaces portlet and IceFaces portlet on one page PrimeFaces doesn't work.
UI is more or less alright, but there are a lot of mistakes in javascript.
Can I solve this problem somehow?
I'm using Liferay 6.0.6

Do not include Primefaces and Icefaces portlets on the same portal page!
Since they both rely on jQuery, they will both include (potentially different versions of) jQuery on the page which will cause javascript conflicts. There may be workarounds for this (although I don't know of any), but it is an extremely bad idea.

Related

c:if as part of composite:insertChildren

I am trying to migrate one app to new app server and JSF seems to start behaving differently due to different JSF implementation. It is MyFaces 2.0 now, that I am having problem with. This worked on older server:
there is composite component <abc:form> that includes <composite:insertChildren> tag.
when using this component in xhtml like this:
<abc:form>
<c:if test="true">
this text will not be visible. But it should be.
</c:if>
</abc:form>
this <c:if... part is children. However nothing is rendered. As if c:if resolved to false, or no testing occurs.
I am aware that this case can be resolved by utilizing <h:outputText> instead of <c:if>, but I have a lot of code where <c:if> is included in more complex children. This example is just a simplification that describes my pain.
So, is it legal to have jstl tags that are includeable as children to components? I assume JSP/JSF lifecycles are to blame here.
edit: As visible in comment below, this is a combination of JSF and portlet (WebSphere Portal 9 on WAS 8.5.5). I am still not sure whether portal (and portal bridge) or pure JSF is to be blamed here. Therefore I created demo project that manifests my problem. If there is any kind soul that can use this code to try deploying it to his/hers own portal, it would be much appreciated.
It was created in Rational Application Developer, by creating new portlet project with one JSF portlet inside. Then I added composite component to WebContent/resources, and modified default portlet view (xhtml).
Exported projects from RAD
I tested your code locally in a simple Tomcat webapp and c:if worked as expected as a child of your composite component. From your comments, you indicated that you are using the MyFaces Portlet Bridge for JSF 2.0. That version of the bridge is 3.0.0-alpha. Since things worked correctly in a webapp (even with MyFaces Core 2.0.0) and the portlet bridge version is still alpha, it seems extremely likely that there is a bug in the bridge (maybe PORTLETBRIDGE-179 ?). Since MyFaces bridge is no longer maintained, I'm doubtful that the bridge will ever be fixed.
I'd recommend that you work around this issue by replacing JSTL tags with JSF HTML tags that essentially render the same markup:
<c:if test="true">... -> <h:panelGroup rendered="true">...
<c:choose><c:when test="true">...<c:otherwise>...
->
<h:panelGroup rendered="true">...<h:panelGroup rendered="false">...
<c:set> -> <ui:param>
<c:forEach> -> <ui:repeat>
See also: JSTL in JSF2 Facelets... makes sense?
One other, more difficult solution would be to implement your composite component as a simple custom Java component or full custom Java component instead.
If there is any kind soul that can use this code to try deploying it to his/hers own portal, it would be much appreciated.
I could not reproduce this issue in Liferay 7.0 + JSF 2.2 + Liferay Faces Bridge 4.1.2. c:if worked fine as a child of your composite component. Full disclosure, I am a Liferay Faces Bridge developer. Unfortunately, I don't think Liferay Faces Bridge will solve your issue since we only support Mojarra (not MyFaces) and JSF 2.1+.

Can Bootsfaces be used with Richfaces?

I have a web application with the following:
JSF 2.2.6
Java 1.7
Tomcat 8
Richfaces 4.5.7
Omnifaces 2.2
I would like to enhance the look and feel of the web app to use Bootsfaces. I have added Bootsfaces jar to my project (via .ivy) and rebuilt.
Before even updating the first web page to use Bootsfaces in the project I wanted to see if there were any conflicts after adding the Bootsfaces jar. It seems there is. I am getting the following errors shown in Firebug:
ReferenceError: jsf is not defined
TypeError: RichFaces.ui is undefined
Does anyone know whether Bootsfaces works with Richfaces and if so could they kindly provide a link with migration steps to follow?
Currently, we, the BootsFaces team, do not support RichFaces. We strive for compatibility with PrimeFaces, OmniFaces, AngularFaces and - if possible - ButterFaces. Neither RichFaces nor ICEFaces are on our list.
However, if someone were to join our team in order to support RichFaces, they'd certainly be welcome!

What needs to be change when migrationg from jsf 1.x to jsf 2.x , richafaces 3.x to 4.x

I am new to jsf.
I am working on migration project.
In this I need to migrate from jsf1.2 to 2.1
and richfaces as well..
In general what I need to change?
I have one more requirement that navigation rules must be quoted explicitly in faces-config.xml?
How to write these rules in faces-config.xml?
Thanks in Advance
First you should understand that this is a painfull to migrate from JSF 1.x to jsf 2.x but it is even more painfull to migrate from Richfaces 3 to Richfaces 4.
JSF 1.x to 2.x upgrade can be done independently from Richface upgrade. So I would recommend you first update JSF and check that everything is working and only after that try updating Richfaces. Look at this question about JSF migration for more info. Or just google it. There is a lot of info about it.
Richfaces 3 to 4 migration is very very painfull because JSF 2 introduced it's own ajax and you will need to change a lot of attributes all overt the project. But the biggest pain is that Richfaces 3 work much more stable than Richfaces 4. Richfaces 4 is very buggy. I can list some bugs that I encountered and some solutions for them.
rich:autocomplete is very buggy. Not sure if it is fixed already
but when I tried using it it was not working with Spring in
composite views(<ui:include pages). After I sumbitted bug report
they seem to do something there but not sure if this works now. I
didn't check. https://issues.jboss.org/browse/RF-11469
I would advise you to replace this component with simple jQuery UI
autocomplete component with some spring mvc controller on backend.
rich:tabPanel is very buggy. Separate tabs do not have action
attribute any more. This was breaking functionality with initing tab
contents when the tab was opened with ajax. Immediate attribute also
not working for tabs. Here is the issue on jboss jira: https://issues.jboss.org/browse/RF-11417 workaround is really stupid.
I just went into source code of richfaces and made it working.
Exception handling is very buggy. Seems that exceptions are just
swallowed in many places in richfaces source on ajax requests so you
can not handle them the right way.
I went again into Richfaces code and removed exception swallowing by
throwing out exceptions.
rich:fileUpload component can work and can not work for you. You
can get request prolog can not be read exception in some
cases(This is what I was getting). And This is connected with new
app server feature of reading multipart request into
request.getParts(). And Richfaces do not handle such situation and
error out because inputstream of multipart request is already read
fully.
I again went to source code of Richfaces and added catch for
situation when request.getParts is not empty. I even created an
issue on Jboss but guys said this works on new Jboss server that's
why it is not an issue(I use tomcat). https://issues.jboss.org/browse/RF-13061 the issue is close still it is not working on tomcat.
A lot of issues on client side. By default multiple forms will not
work on your pages like they were working in jsf 1.2 and richfaces 3
because the viewstate id is not updated where and when it needs to
be.
To fix this you will need to add additional script. It is described
in the answer to this question
Also on the client side you should know that if in the response of
any ajax request you will have some js that will fail everything
stops working. You can not have js errors inside xhtml. The page
will freeze completelly. Also it is tricky to have CDATA tags on
the xhtml pages. They can also fail.
Richfaces messages work the way that sometimes they show up and
sometimes not. They are ajax rendered but seems that they can break
the page. Ajax reposnse can have an update that should update
messages that is not rendered on the page and when it will not find
this message in your html it will stop rendering everything that is
left to update. As a result your links and buttons will not rerender
anything in some cases.
Here evaluating limitRenderattribute helps a lot.
It is a short list. There probably a lot more to be aware of and that you will see after update =)) Richfaces 4 are still buggy.

Which jsf component library best suits Liferay portlet application

Could any one throw some light on the following jsf component libraries to be used in Liferay portlet development which supports Inter Portlet Communication (IPC), Ajax Push Support and JSF - Portlet bridge, community support etc., for Primefaces, Richfaces, Icefaces and Myfaces.
--Velu
From my own experience I have to agree with what doc_180 says, among the frameworks you mention ICEFaces is definitely the best choice, but stick to new 2.0+ version as it has many improvements.
A lot can off course also be done by using the same stack as Liferay itself uses in the 6+ version: Struts/MVC-portlet + AlloyUI
ICEFaces works like a charm with liferay. Especially with ajax push support, its a very good choice.

What will be better view with JSF technology

I am using Struts Tiles with JSF to have one header, menu and footer across application. Is there any other like struts to have one header, menu and footer. Is this feature available in faceslets and what viewing technology would be better for easy development.
For JSF you've only choice of two view technologies. The good old JSP and the improved and XHTML based Facelets. Facelets is much more suited to JSF than JSP. It is a view technology and template framework in one. It provides great templating capabilities and since JSF 2.0 also composite components, while JSP basically only offers the <jsp:include> for templating, so that you're forced to create custom components with raw Java code (which is a bit opaque and a lot of tedious work in JSF) when you want to replace a repeated group of components by a single component. If you can, I recommend to drop JSP and Tiles altogether and go for Facelets when you want to develop with JSF. If you're going for JSF 2.0 as well, it would already be a major step ahead as opposed to JSF 1.x.
Facelets is the first choice for JSF. Your task can be easily solved with Facelets.

Resources