7

In JSF and Facelets tags, what exactly are these prefixes?

  • h:
  • c:
  • f:
  • ui:

For example: h:head c:catch f:event ui:decorate etc.

Edward
  • 5,942
  • 4
  • 38
  • 55
exexzian
  • 7,782
  • 6
  • 41
  • 52

1 Answers1

9

A prefix is used to qualify a tag as belonging to a specific tag library or in XML speak a namespace. The prefixes are declared in some way at the top of a JSF page (how depends on if you are using JSP or Facelets). An "h" usually corresponds to the HTML library but you could use any letter (or word) you wanted as the prefix. The common mappings are:

h http://java.sun.com/jsf/html
f http://java.sun.com/jsf/core
c http://java.sun.com/jsp/jstl/core
fn http://java.sun.com/jsp/jstl/functions
ui http://java.sun.com/jsf/facelets
Chase
  • 3,123
  • 1
  • 30
  • 35
  • ohh thanks, so these prefixes maps with above particular links. but these linkes are not working - opening them says "Sorry! We couldn't find your document." – exexzian Jul 24 '12 at 23:42
  • 3
    The taglib URI doesn't necessarily need to be a real web address. It's merely an unique namespace idenfifier which is declared in the `` element of a `.taglib.xml` file which is placed in the `/META-INF` folder of the tag library JAR file which is in turn placed in webapp's `/WEB-INF/lib`. Note that the prefix can be changed freely to your choice. You can for example just declare `xmlns:foo="http://java.sun.com/jsf/html"` and use `` and so on. – BalusC Jul 25 '12 at 01:49