• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can the new Facelet Tag Libraries URI's be used in older JSF versions?

 
Alex Orozco
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In JSF 2.2 the Facelet Tag Libraries URI's changed from: to: so that means the new namespaces applies only for JSF 2.2 or they can or should be used in older versions like 2.0, 2.1 or 1.x?

Thanks.
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're saying what I think you're saying, the URIs are used to identify XML schemas. XML schemas are used by the XML digesting code to validate XML. They do not control what version of the tag library will be used, just what syntax-checking rules will be applied when digesting the View Template.

Or in other words, if you use the wrong schema, the digester may reject a View Template that uses features that are supported by the tag library but not by the schema. Or, conversely, allow you to create View templates that are parsed as valid, but not properly processable by the tag library.
 
Alex Orozco
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I'm not sure if we are on the same page (sorry, I'm new to JSF ), on the specification says that the old tag libs, for example:

were replaced by:

But it does not clarify if the new taglibs are used only for the new JSF 2.2 version or for all versions, for example, I'm not sure if this code is valid for an old JSF version i.e. JSF 2.0


Thanks
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried typing "http://xmlns.jcp.org/jsf/core" into your web browser?

The URIs do not control what tag libraries are used. They control what XML schemas are used to validate the XML that they are referenced from. That's ALL they're used for. They don't locate any software components, they only guide the compilation process of the View Template in a simple binary fashion - "pass" or "fail". If the View Template (.xhtml) file contains elements or attributes not defined by one of the schemas provided, the entire XML will be rejected. Likewise, the XML will be rejected if you don't provide all the elements and/or attributes a schema demands. You can see this in action by ripping out one of the namespace references such as "http://xmlns.jcp.org/jsf/html". The page will no longer be processable even though the actual tag libraries are still present.

If you reference a schema that doesn't accurately represent the tag libraries, then things may go wrong at runtime, because the XML will have been digested into a DOM that doesn't match what the tag libraries expect.

I'm not sure about the switch from the sun domain to the jcp domain. Ordinarily, I'd say that jcp would be only applicable to pre-release implementations, but Oracle may be getting less involved in the standard and thus backing away from the sun domain name. What matters isn't the namespace name, however, it's how well that particular schema maps to the JSF tag libraries that you are actually using. If you code JSF2.2 schemas into an app and only use JSF2.0 features, you'd have no problems if your webapp server is based on JSF2.0 tag libraries. But if you code JSF2.2 XML into your View Templates, that won't magically upgrade the underlying tag libraries. They'll remain at 2.0.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!