webtier@glassfish.java.net

JSF CompositeComponent: PropertyNotFoundException when bean throw Exception

From: <webtier_at_javadesktop.org>
Date: Tue, 14 Sep 2010 03:44:39 PDT

If you have a JSF Composite Component that has an action method attribute, like this:

<cc:interface>
  <cc:attribute name="action" method-signature="java.lang.String action()" />
</cc:interface>
<cc:implementation>
...
<h:commandButton value="submit" action="#{cc.attrs.action}" />
...

and calling this component from a page like:

  <cc:test text="#{bean.text}" action="#{bean.submit}" />

All works as fine until the Bean.submit() method throws an exception (like IllegalArgumentException). JSF would then not evaluate the #{bean.submit} expression and report a very confusing PropertyNotFoundException. If you "inline" the command button in the page and not use the <cc:test> tag:

<h:commandButton value="submit" action="#{bean.submit}" />

you'll get the expected IllegalArgumentException. We really need the IEA and not PNFE for our error reporting to work.

Is this a bug or a feature?

See http://stackoverflow.com/questions/3487489/jsf2-composite-component-action-isnt-recognized
for further information and example
[Message sent by forum member 'jorgenpfalk']

http://forums.java.net/jive/thread.jspa?messageID=482704