JSF action/rendered behavior

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JSF action/rendered behavior

Dennis_Byrne

<h:commandButton value="Cancel" immediate="true" action="#{myBacker.myMethod}"  rendered="#{myBacker.editMode}" />

myBacker is a request scoped managed bean.

When the button is clicked, the backing bean is created, but myMethod does not fire.  The runtime will not complain if @action is set to myBacker.myNonExistMethod .  

The method will fire if true is the literal value of @rendered, or if the editMode property is set to true in the constructor.

It appears as though the action will not fire, if the rendered expression evaluates to false.
Can anyone explain otherwise?  More importantly, can someone educate me as to why this is a good idea?

Dennis Byrne
Reply | Threaded
Open this post in threaded view
|

Re: JSF action/rendered behavior

ir. ing. Jan Dockx
To my knowledge, that's expected behavior: rendered=false makes a
component inert in all phases.


On 2 Aug 2005, at 4:09, [hidden email] wrote:

>
> <h:commandButton value="Cancel" immediate="true"
> action="#{myBacker.myMethod}"  rendered="#{myBacker.editMode}" />
>
> myBacker is a request scoped managed bean.
>
> When the button is clicked, the backing bean is created, but myMethod
> does not fire.  The runtime will not complain if @action is set to
> myBacker.myNonExistMethod .  
>
> The method will fire if true is the literal value of @rendered, or if
> the editMode property is set to true in the constructor.
>
> It appears as though the action will not fire, if the rendered
> expression evaluates to false.
> Can anyone explain otherwise?  More importantly, can someone educate
> me as to why this is a good idea?
>
> Dennis Byrne
>
Met vriendelijke groeten,

Jan Dockx

PeopleWare NV - Head Office
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66

PeopleWare NV - Branch Office Geel
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25

http://www.peopleware.be/
http://www.mobileware.be/

smime.p7s (3K) Download Attachment