[jsr-314-open] Mixing an ajax tag with a rendered attribute

Martin Marinschek mmarinschek at APACHE.ORG
Fri May 29 03:43:19 EDT 2009


Hi,

Trinidad also suffers from this problem. Same solution there - wrapper
component. Where I have problems is when this wrapper component blows
the layout.

We really need a component which can define that it is transparent to
the surrounding layout components!

regards,

Martin

On 5/29/09, Dan Allen <dan.j.allen at gmail.com> wrote:
> On Thu, May 28, 2009 at 6:40 PM, Jim Driscoll <Jim.Driscoll at sun.com> wrote:
>
>> This is one of those "we should have seen this coming" bugs  (and for all
>> I
>> know, maybe others did - but I hadn't thought about it).
>>
>> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1139
>>
>>
>> If you're doing this:
>>
>>            <h:panelGrid>
>>                <h:outputText value="Shipping/Billing address is the same"
>> />
>>                <h:selectBooleanCheckbox value="true" >
>>                    <f:ajax listener="#{order.toggle}"
>> render="shippingGroup"/>
>>                </h:selectBooleanCheckbox>
>>            </h:panelGrid>
>>            <h:panelGroup id="shippingGroup"
>> rendered="#{order.renderShipping}">
>>                <fieldset>
>>                    <legend>Shipping Address</legend>
>>                    <comp:address id="shippingAddress"
>>                                  city="#{addressBean.city}"
>>                                  state="#{addressBean.state}"
>>                                  zip="#{addressBean.zip}"
>>                                  street="#{addressBean.street}" />
>>                </fieldset>
>>            </h:panelGroup>
>>
>>
>> where "toggle" changed the order.renderShipping property, then it's going
>> to fail in both directions - both when you change from not rendered to
>> rendered (because we're doing an update on something that doesn't exist)
>> and
>> when changing from rendered to not rendered (because we're doing an update
>> that won't have any data).
>>
>> The upshot - if you're using f:ajax to toggle the rendered attribute of
>> something that you're rendering, it's not going to work.
>
>
> This is a very familiar issue for developers that have used Ajax4jsf for any
> length of time. So common, in fact, that Ajax4jsf offers a component which
> renders a placeholder to make this very use case possible. Max Katz even
> dedicates a whole section of Practical RichFaces on the problem. So I would
> be very interested to here what Mr. Smirmov has to say given that he has
> likely lost nights of sleep thinking about how to deal with it ;)
>
> Of course, the simple solultion is to use a wrapper component (such as a
> panelGroup) which is rerendered and have the toggle inside of that wrapper.
>
> -Dan
>
>
> --
> Dan Allen
> Senior Software Engineer, Red Hat | Author of Seam in Action
>
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
> http://in.relation.to/Bloggers/Dan
>
> NOTE: While I make a strong effort to keep up with my email on a daily
> basis, personal or other work matters can sometimes keep me away
> from my email. If you contact me, but don't hear back for more than a week,
> it is very likely that I am excessively backlogged or the message was
> caught in the spam filters.  Please don't hesitate to resend a message if
> you feel that it did not reach my attention.
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




More information about the jsr-314-open-mirror mailing list