I'm having trouble creating custom components in JSF, it's actually the first time.
I found some guides on the internet but it did not work.
What I did was the following.
I created custom.taglib.xml
inside the folder WEB-INF
and its content is this.
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib>
<namespace>http://paradigma.ecred2/facelets</namespace>
<tag>
<tag-name>btnHelp</tag-name>
<source>tags\btn-help.xhtml</source>
</tag>
</facelet-taglib>
Inside the resources
folder, I created the file btn-help.xhtml
with the following content.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<cc:interface>
<cc:attribute name="hint" />
</cc:interface>
<cc:implementation>
<p>#{cc.attrs.hint}</p>
</cc:implementation>
</html>
And finally inside the page where I want to use this component, it follows the heading.
<ui:composition template="/template/common/pagelayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ez="http://xmlns.jcp.org/jsf/composite"
xmlns:sec="http://www.springframework.org/security/facelets/tags"
xmlns:ecred="http://paradigma.ecred2/facelets/tags">
And the component call
<ecred:btnHelp hint="Teste"/>
The problem is that the component is not being rendered, and I do not know what might be happening. The idea is to make components that are simpler for example.
Make a help button that already loads a certain image and the developer only passes the text.
<p:graphicImage url="#{resource['images:help-icon.png']}" title="#{cc.attrs.hint}"/>
Thank you