Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Fixed minor typos
Source Link
Aritz
  • 31.8k
  • 16
  • 147
  • 232

A composite component getgets indeed rendered as a single component. You want to use a Facelet tag file instead. It getgets rendered exactly as whatever its output renders. Here's a kickoff example assuming that you want a 3-column form with a message field in the third column.

A composite component get indeed rendered as a single component. You want to use a Facelet tag file instead. It get rendered exactly as whatever its output renders. Here's a kickoff example assuming that you want a 3-column form with a message field in the third column.

A composite component gets indeed rendered as a single component. You want to use a Facelet tag file instead. It gets rendered exactly as whatever its output renders. Here's a kickoff example assuming that you want a 3-column form with a message field in the third column.

fixed typo
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k
<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0facelettaglibrary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 
<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 
<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 
clarified meta-inf versus web-inf usage
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k

Create tag file in /METAWEB-INF/tags/input.xhtml: (or in /META-INF when you want to provide tags in a JAR file which is to be included in /WEB-INF/lib).

Define it in /METAWEB-INF/example.taglib.xml (file name must matchor in *.taglib.xml/META-INF in orderwhen you want to get itprovide tags in a JAR file which is to be auto-loaded by JSFincluded in /WEB-INF/lib):

<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 

Declare the taglib usage in /WEB-INF/web.xml (this is not needed when the tags are provided by a JAR file which is included in /WEB-INF/lib! JSF will auto-load all *.taglib.xml files from /META-INF).

<context-param> <param-name>javax.faces.FACELETS_LIBRARIES</param-name>  <param-value>/WEB-INF/example.taglib.xml</param-value> </context-param> 

(multiple taglib files can be separated by semicolon ;)

Create tag /META-INF/tags/input.xhtml:

Define it in /META-INF/example.taglib.xml (file name must match *.taglib.xml in order to get it to be auto-loaded by JSF):

<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 

Create tag file in /WEB-INF/tags/input.xhtml (or in /META-INF when you want to provide tags in a JAR file which is to be included in /WEB-INF/lib).

Define it in /WEB-INF/example.taglib.xml (or in /META-INF when you want to provide tags in a JAR file which is to be included in /WEB-INF/lib):

<?xml version="1.0" encoding="UTF-8"?> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0.xsd" version="2.0"> <namespace>http://example.com/jsf/facelets</namespace> <tag> <tag-name>input</tag-name> <source>tags/input.xhtml</source> </tag> </facelet-taglib> 

Declare the taglib usage in /WEB-INF/web.xml (this is not needed when the tags are provided by a JAR file which is included in /WEB-INF/lib! JSF will auto-load all *.taglib.xml files from /META-INF).

<context-param> <param-name>javax.faces.FACELETS_LIBRARIES</param-name>  <param-value>/WEB-INF/example.taglib.xml</param-value> </context-param> 

(multiple taglib files can be separated by semicolon ;)

fixed
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k
Loading
manually registering taglib.xml is not mandatory since JSF 2
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k
Loading
added 86 characters in body
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k
Loading
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k
Loading