Note that there are some explanatory texts on larger screens.

plurals
  1. POcannot use values from beans in facelets custom component
    text
    copied!<p>i cannot use any bean value in my custom control.: for instance:</p> <p>this is my foo.taglib.xml file.</p> <pre><code>&lt;facelet-taglib&gt; &lt;namespace&gt;http://www.penguenyuvasi.org/tags&lt;/namespace&gt; &lt;tag&gt; &lt;tag-name&gt;test&lt;/tag-name&gt; &lt;component&gt; &lt;component-type&gt;test.Data&lt;/component-type&gt; &lt;/component&gt; &lt;/tag&gt; &lt;/facelet-taglib&gt; </code></pre> <p>faces-config.xml</p> <pre><code> &lt;component&gt; &lt;component-type&gt;test.Data&lt;/component-type&gt; &lt;component-class&gt;test.Data&lt;/component-class&gt; &lt;/component&gt; </code></pre> <p>test.Data class</p> <pre><code>package test; import java.io.IOException; import javax.faces.component.UIComponentBase; import javax.faces.context.FacesContext; public class Data extends UIComponentBase { private Object msg; @Override public String getFamily() { return "test.Data"; } @Override public void encodeBegin(FacesContext context) throws IOException { super.encodeBegin(context); context.getResponseWriter().write(msg.toString()); } public void setMsg(Object msg) { this.msg = msg; } } </code></pre> <p>Bean.java:</p> <pre><code>package test; public class Bean { private String temp = "vada"; public String getTemp() { return temp; } } </code></pre> <p>test.xhtml (doesn't work)</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://www.penguenyuvasi.org/tags"&gt; &lt;py:test msg="#{bean.temp}" /&gt; &lt;/html&gt; </code></pre> <p>test.xhtml (works)</p> <pre><code> &lt;py:test msg="#{bean.temp}" /&gt; </code></pre>
 

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