I tried xmlns:h="jakarta.faces.html", xmlns:h="http://jakarta.faces.html", xmlns:h="https://jakarta.faces.html" and other similar strings, but nothing seems to work.
The xmlns:h="jakarta.faces.html" is introduced in Faces 4.0, part of Jakarta EE 10.
In JSF 3.0, part of Jakarta EE 9, it is still xmlns:h="http://xmlns.jcp.org/jsf/html".
Summary of API packages and XML namespace URIs to use:
J2EE 1.4 / JSF 1.0-1.1: javax.faces.* and http://java.sun.com/jsf/*
Java EE 5 / JSF 1.2: javax.faces.* and http://java.sun.com/jsf/*
Java EE 6 / JSF 2.0-2.1: javax.faces.* and http://java.sun.com/jsf/*
Java EE 7 / JSF 2.2: javax.faces.* and http://xmlns.jcp.org/jsf/*
Java EE 8 / JSF 2.3: javax.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 8 / JSF 2.3: javax.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 9 / JSF 3.0: jakarta.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 10 / Faces 4.0: jakarta.faces.* and jakarta.faces.*
Noted should be that the XML namespace URIs are backwards compatible in each newer version. So in e.g. Faces 4.0 you can still use the http://java.sun.com/jsf/* and http://xmlns.jcp.org/jsf/* URIs next to jakarta.faces.*. But this is clearly not recommended as support for old URIs are still prone to be removed sometime in the future and any new components/tags introduced for the first time in a newer URI are not necessarily available via older URIs.
Faces 4.0 is the first version to use a URN instead of URL as XML namespace URI. So the URL-form with http(s):// prefix is invalid. The reason for using a URN instead of URL is because those taglib URIs are in first place not available as physical web resources returning some sort of XSD file and therefore caused confusion among starters. Moreover, URNs are more future-proof as you don't necessarily need to include a hostname such as java.sun.com or xmlns.jcp.org which are more sensitive to change of name/owner than an API name.
See also:
Faces 4.0: rename xmlns.jcp.org taglib URIs
Which XML namespace to use with JSF 2.2 and up
JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output
Related
I tried xmlns:h="jakarta.faces.html", xmlns:h="http://jakarta.faces.html", xmlns:h="https://jakarta.faces.html" and other similar strings, but nothing seems to work.
The xmlns:h="jakarta.faces.html" is introduced in Faces 4.0, part of Jakarta EE 10.
In JSF 3.0, part of Jakarta EE 9, it is still xmlns:h="http://xmlns.jcp.org/jsf/html".
Summary of API packages and XML namespace URIs to use:
J2EE 1.4 / JSF 1.0-1.1: javax.faces.* and http://java.sun.com/jsf/*
Java EE 5 / JSF 1.2: javax.faces.* and http://java.sun.com/jsf/*
Java EE 6 / JSF 2.0-2.1: javax.faces.* and http://java.sun.com/jsf/*
Java EE 7 / JSF 2.2: javax.faces.* and http://xmlns.jcp.org/jsf/*
Java EE 8 / JSF 2.3: javax.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 8 / JSF 2.3: javax.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 9 / JSF 3.0: jakarta.faces.* and http://xmlns.jcp.org/jsf/*
Jakarta EE 10 / Faces 4.0: jakarta.faces.* and jakarta.faces.*
Noted should be that the XML namespace URIs are backwards compatible in each newer version. So in e.g. Faces 4.0 you can still use the http://java.sun.com/jsf/* and http://xmlns.jcp.org/jsf/* URIs next to jakarta.faces.*. But this is clearly not recommended as support for old URIs are still prone to be removed sometime in the future and any new components/tags introduced for the first time in a newer URI are not necessarily available via older URIs.
Faces 4.0 is the first version to use a URN instead of URL as XML namespace URI. So the URL-form with http(s):// prefix is invalid. The reason for using a URN instead of URL is because those taglib URIs are in first place not available as physical web resources returning some sort of XSD file and therefore caused confusion among starters. Moreover, URNs are more future-proof as you don't necessarily need to include a hostname such as java.sun.com or xmlns.jcp.org which are more sensitive to change of name/owner than an API name.
See also:
Faces 4.0: rename xmlns.jcp.org taglib URIs
Which XML namespace to use with JSF 2.2 and up
JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output
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.
Is it possible to design a Java EE web application without using Java servlets? Do JSF and Facelets are an alternative?
i guess you need to polish your background in understanding the relation between servlet and jsp and jsf. You can take a look at BalusC's great post "What is the difference between JSF, JSP and Servlet?"
JSF pages are built on top of servlets, as an example JSF provides the FacesServlet as the request response controller. Without any knowledge of them you can write web applications.
On the other hand each Jsf version requires a servlet version. As an example jsf 2.0 and above requires servlet 3.0 specifications, and should be backwards compatible with Servlet 2.5.
Last week IceFaces has released its new version 2.0.0. It was long been in the beta version and finally came out to final version. In the release notes it is specified as "JSPs are not supported by ICEfaces 2.0 - use Facelets". What does that mean?. Are we not suppose to write any JSP's?. What about the existing projects running on JSP files.
Please advise me.
It's not that IceFaces specifically doesn't support JSPs. It's the fact that IceFaces 2.0.0 is based on JSF 2.0 and it takes advantage of a couple of JSF 2.0 specific features.
A lot of the new JSF 2.0 specific features are simply not supported in JSP. So if any technology depends on those features, it automatically doesn't support JSP. (this is one reason why it's so important for legacy JSF projects to migrate from JSP to Facelets ASAP).
I put some references to authoritative sources on the wikepedia article about Facelets (http://en.wikipedia.org/wiki/Facelets). This is the one from the official specification (emphasis mine).
JSF 2.0 (JSR 314, http://jcp.org/en/jsr/detail?id=314) specification, maintenance release 2, section 10.1:
Facelets is a replacement for JSP that was designed from the outset with JSF in mind. New features introduced in version 2 and later are only exposed to page authors using Facelets. JSP is retained for backwards compatibility.
From JSF 2.0, Facelets is the official view technology. Even if JSP is supported it will be minimal. Read more here
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.