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.

2
  • Your two questions are mostly unrelated. You'd get better answers by asking each one in a separate post.
    – Edward
    Jul 24, 2012 at 23:14
  • ohh thanks... lemme post them separately
    – exexzian
    Jul 24, 2012 at 23:16

1 Answer 1

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
2
  • 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, 2012 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 <namespace> 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 <foo:outputText> and so on.
    – BalusC
    Jul 25, 2012 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.