You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Leonardo Uribe <lu...@gmail.com> on 2012/10/05 05:52:57 UTC
[core] avoid throw exception when #{cc.attrs.actionListener} or
#{cc.attrs.action} or similar EL expressions are resolved
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
Re: [core] avoid throw exception when #{cc.attrs.actionListener} or
#{cc.attrs.action} or similar EL expressions are resolved
Posted by Leonardo Uribe <lu...@gmail.com>.
Hi
I think the best is change it. I'll propose a patch soon.
regards,
Leonardo
2012/10/5 Dennis Hörsch <ho...@his.de>:
> 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
>
>
Re: [core] avoid throw exception when #{cc.attrs.actionListener}
or #{cc.attrs.action} or similar EL expressions are resolved
Posted by Dennis Hörsch <ho...@his.de>.
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