myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Hörsch <hoer...@his.de>
Subject Re: [core] avoid throw exception when #{cc.attrs.actionListener} or #{cc.attrs.action} or similar EL expressions are resolved
Date Fri, 05 Oct 2012 06:51:48 GMT
Hi Leonardo,

I fell over that with an empty action-Attribute too as I was migrating 
old-style JSF1-facelets components to composites and some users of that 
had an empty action. I was wondering why it throws an exception instead 
of behaving like a 'normal' commandButton.

Greetings
Dennis Hörsch


Am 05.10.2012 05:52, schrieb Leonardo Uribe:
> Hi
>
> I have been thinking about this report:
>
> https://issues.apache.org/jira/browse/MYFACES-3613
>
> NPE in composite component when ActionListener is missing in the source
>
> 	<cc:interface>
> 		<cc:attribute name="action"/>
> 		<cc:attribute name="actionListener"/>
>          <cc:attribute name="value"/>
> 	</cc:interface>
> 	<cc:implementation>		
> 		<h:commandButton value="#{cc.attrs.value}"
> action="#{cc.attrs.action}"
> actionListener="#{cc.attrs.actionListener}" immediate="true">
> 			<cc:insertChildren/>
> 		</h:commandButton>
> 	</cc:implementation>
>
> Right now, MyFaces just throw an exception when the attributes are not set
> in the composite component, but doesn't sound more reasonable avoid the
> exception and act like nothing happened?
>
> In practice h:commandButton will have a dummy listener and an action attached,
> but that's the same as if both attributes were empty. I can't imagine any side
> effect, and it is a common case when you are using composite components.
>
> regards,
>
> Leonardo Uribe


Mime
View raw message