Note that there are some explanatory texts on larger screens.

plurals
  1. POFacelets custom function not found
    primarykey
    data
    text
    <p>I'm writing a simple custom function in Facelets with a sample method. The problem is that the JSF 2 application fails to locate that function. The error message is: </p> <pre><code>/test.xhtml @15,73 rendered="#{test:isGranted('ONE_ROLE')}" Function 'test:isGranted' not found. </code></pre> <p>I've been checking and rechecking and can't find the problem. Any comment here would be really appreciated as it's clear that I'm missing something (but it seems that the steps involved are really simple).</p> <p>Do you know if there are other requisites?</p> <p>Thanks in advance.</p> <p>The relevant code:</p> <p>In the <strong>web.xml</strong> the tag XML descriptor is declared</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;javax.faces.FACELETS_LIBRARIES&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/test.taglib.xml&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>The file <strong>test.taglib.xml</strong>:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd"&gt; &lt;facelet-taglib&gt; &lt;namespace&gt;http://www.test.com/security/tags&lt;/namespace&gt; &lt;function&gt; &lt;function-name&gt;isGranted&lt;/function-name&gt; &lt;function-class&gt;com.test.security.taglibs.IsGranted&lt;/function-class&gt; &lt;function-signature&gt;boolean isGranted(java.lang.String role)&lt;/function-signature&gt; &lt;/function&gt; &lt;/facelet-taglib&gt; </code></pre> <p>The tag class:</p> <pre><code>public class IsGranted extends TagHandler { public static boolean isGranted(String role) { // Do nothing. Just a test. return false; } } </code></pre> <p>And the test file:</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:test="http://www.test.com/security/tags"&gt; &lt;body&gt; &lt;h:outputText value="You should NOT see this." rendered="#{test:isGranted('ONE_ROLE')}"/&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload