Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had the same problem and I found out that it was due to that my action method did throw IllegalArgumentException. Meanwhile this has been reported as a bug: <a href="http://java.net/jira/browse/JAVASERVERFACES-1806" rel="noreferrer"> Composite action method throws PropertyNotFoundException when method throws any exception</a>.</p> <p>The tricky part (at least for me) was that my app had been working fine until I moved part of the code into a Composite Component (CC). Before my app would caught the IAE and show a nice error message but when using CC, the JSF validation (or whatever...) catches this first and produce this rather confusing error message.</p> <p>I verified this by using a modified version of the test code provided by BalusC (See below). The test page shows two input &amp; submit button components. If you enter something in the text field (apart from "panic" (without quotes)), both the CC-version and the "inline" version works (watch the std output). If you enter "panic" in the "inlined" version, you'll notice the IAE as expected, but if you enter the same thing in the upper "CC-version" you'll see the PropertyNotFoundException instead. Seems that JSF gets confused by the IAE and decides that the attribute must be a property and not an action method after all... Not sure if this is a bug or a feature. Is this according to Spec, does anybody know?</p> <p>So, the conclusion here is that you can't use action methods in CC with beans that throw exceptions. For me, this means that I can't use Composite Components. Sad!</p> <p>Hope this helps...</p> <pre><code>/resources/components/test.xhtml &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:cc="http://java.sun.com/jsf/composite"&gt; &lt;cc:interface&gt; &lt;cc:attribute name="text"/&gt; &lt;cc:attribute name="action" method-signature="java.lang.String action()" required="true" /&gt; &lt;/cc:interface&gt; &lt;cc:implementation&gt; &lt;h:form&gt; &lt;h:inputText value="#{cc.attrs.text}"/&gt; &lt;h:commandButton value="submit" action="#{cc.attrs.action}" /&gt; &lt;/h:form&gt; &lt;/cc:implementation&gt; </code></pre> <p> </p> <pre><code>/test.xhtml &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:cc="http://java.sun.com/jsf/composite/components"&gt; &lt;h:head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;!-- text and cmd-button as cc --&gt; &lt;cc:test text="#{bean.text}" action="#{bean.submit}" /&gt; &lt;hr/&gt; &lt;!-- text and cmd-buuton inline --&gt; &lt;h:form id="inline"&gt; &lt;h:inputText value="#{bean.text}"/&gt; &lt;h:commandButton value="submit2" action="#{bean.submit}" /&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>And last the Bean:</p> <pre><code>@ManagedBean @RequestScoped public class Bean { private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } public String submit() { if (text.equalsIgnoreCase("panic")){ throw new IllegalArgumentException("Panic!"); } System.out.println(text); return null; } } </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