How get Tomahawk functionality with JSF 2.0 (Glassfish V3) - jsf

I've started to upgrade an existing application written with JSF 1.1 and MyFaces Tomahawk 1.1 to JSF 2.0 to get facelets etc.
I've now run into the snag that apparently Tomahawk is not JSF 2.0 compatible as it expects the stand-alone version of Facelets instead of the built-in to JSF 2.0 with the following error:
org.apache.catalina.LifecycleException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! com.sun.facelets.tag.jsf.ComponentHandler
(it appears to be placed in javax.faces.view.facelets now).
I have looked around and there doesn't seem to be a JSF 2.0 facelet compatible version of Tomahawk. I only believe I need t:updateActionListener (inside t:dataTable) and the rowSpan facility of t:panelGroup. Is all this functionality available in JSF 2.0 directly, or must I locate a new library giving this?
Any suggestions?

The t:updateActionListener is covered by the JSF 1.2 f:setPropertyActionListener.
For rowspans (and colspans) there's unfortunately still no functionality in the standard JSF implementation. However, since JSF 1.2 you're allowed to write down "plain vanilla" HTML in the view without any pains (no hassle with f:verbatim and so on). You can make use of the Facelets' ui:repeat to iterate "plain" over a collection. Since JSF 2.0 you can even create composite components (templatebased components). This must enable you to make use of the HTML rowspans/colspans.

Related

How do I determine in which JSF version a tag was added?

I am in the process of upgrading an old web application from MyFaces 1.1 to version 2.2. I am new to JSF and still have a lot to learn about it (struggling a lot along the way). Because of this I often don't understand why a specific tag was used from some 3rd party tag library instead of the core JSF libraries.
For example, the application uses the t:stylesheet tag from the Tomahawk component library in the head of the page even though there seems to be a h:outputStylesheet tag in the html library of JSF.
I was wondering if the outputStylesheet tag wasn't available in JSF 1.1 and was only added later or if there is another reason for choosing the Tomahawk tag over the JSF html tag.
Is there a way to determine which version of JSF added a specific tag to the core libraries? Apart from replacing the "2.1" in http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/h/outputStylesheet.html until I reach a the URL that isn't available?

Can I use more than one JSF implementation in the same project?

Can I use more than one JSF implementation in the same project?
Can I mix PrimeFaces with MyFaces for example?
What are implications of that?
No, you cannot mix JSF implementations. By the way, PrimeFaces is not a JSF implementation. MyFaces is a JSF implementation, just like Mojarra.
You could however mix component libraries like PrimeFaces. See for example how you can use both BootsFaces and PrimeFaces, or OmniFaces and PrimeFaces (OmniFaces is mainly a utility library, but has some components).
Note that you do need a JSF implementation in order to be able to use a JSF component library at all. If you are using a JavaEE server (like Payara or WildFly), the JSF implementation is already provided by the server.
See also:
JSF implementations and component libraries

Do I need to create a new taglib.xml file when migrating JSF 1.1 to JSF 2.0 while keeping JSP as view technology

Hi I have an application that needs to be migrated from jsf1.1 to jsf2.0. I have read the answers posted in Migrating from JSF 1.2 to JSF 2.0 by BalusC.
I have thought not to go ahead converting JSP to facelets.Retain the JSP2.x as the view technology.
I would request someone to clarify couple of my doubts.
As a part of migrating the custom components is it a must to create a new custom-taglib.xml file ? Can't I retain .tld files as it is.
Since JSF implementations like JSF 2.0 provides backward compatibility with older versions, Is it necessary to change the custom compoent code, for the deprecated methods and replace it with the appropriate methods from JSF 2.0? because we are not migrating it completely to facelets.
Do I need to create a new taglib.xml file when migrating JSF 1.1 to JSF 2.0 while keeping JSP as view technology?
No. The *.taglib.xml files are for Facelets what *.tld files are for JSP.

Tag Library supports namespace: https://ajax4jsf.dev.java.net/ajax, but no tag was defined for name: support

When I tried to add <a4j:support> tag to JSF 2.0, I got the following error
Tag Library supports namespace: https://ajax4jsf.dev.java.net/ajax, but no tag was defined for name: support
How is this caused and how can I solve it?
The namespace URI https://ajax4jsf.dev.java.net/ajax is recognizable as the one from Ajax4jsf 1.x which existed in the prehistory, long before Ajax4jsf was acquired by RichFaces 3.x at 2006. Ajax4jsf 1.x is an ancient tag library which was targeted at JSF 1.1 on JSP, long before JSF 2.0 was introduced with builtin ajax functionality.
Even more, currently with JSF 2.0, JSP is deprecated and succeeded by Facelets (which a lot of starters overgeneralize as "XHTML"). JSP targeted tag libraries like Ajax4jsf 1.x are not compatible with Facelets. You basically need a JSF 2.0 compatible tag library instead. If you're looking for Ajax4jsf functionality, then you should be looking for RichFaces 4.x. Note that <a4j:support> has since RichFaces 4.x been renamed to <a4j:ajax> to be in line with JSF 2.0 standard <f:ajax>.
However, as said, JSF 2.0 thus already offers builtin ajax functionality in flavor of <f:ajax>. Given that you're attempting to use Ajax4jsf 1.x on JSF 2.0, you were perhaps reading a hopelessly outdated JSF book/tutorial/resource. I strongly recommend to put that aside and look for a more recent one, preferably not older than 2010 if you want a JSF 2.0 targeted one. You can find several sane tutorials linked somewhere in the bottom of our JSF wiki page.
Good luck.

Migrating from JSF 1.1 to JSF 1.2

Can anybody tell me what things I need to keep in mind before migrating an application from JSF 1.1 to JSF 1.2?
Not much, really. JSF 1.2 is 100% backwards compatible with JSF 1.1. Only thing which you need to take into account that JSF 1.2 fixes many, really many bugs. So if you ever incorrectly assumed some specific JSF 1.1 application behavior as "normal" behavior, but which is under the covers actually caused by a bug, then it would seemingly break.
In any case, just run unit tests before and after the upgrade and fix the issues individually.
It's only migrating from JSF 1.x to 2.x which requires more work, for sure if you also need to change the view technology from JSP to Facelets. For that, refer this answer: Migrating from JSF 1.2 to JSF 2.0.

Resources