[jsr-314-open] Ajax rendering of components among compositions?

Dan Allen dan.j.allen at GMAIL.COM
Mon May 25 11:02:14 EDT 2009


On Mon, May 25, 2009 at 8:49 AM, Andy Schwartz <andy.schwartz at oracle.com>wrote:

> Jim Driscoll wrote On 5/25/2009 2:23 AM ET:
>
>> Well, it can't be a div anyway, since that changes the layout from inline
>> to block.
>>
>> I guess we could wrap every single component in a span, but that's quite a
>> bit of extra characters for what is going to be rarely necessary.
>>
>
> Actually, we cannot do this, since the composite component implementation
> may include block-level content.  Nesting this within inline content (eg. a
> <div> nested within a <span>) would result in invalid html.  The composite
> component author needs to specify the appropriate type of root element for
> their implementation.


Ah, okay. This is like the same dilemma that the Ajax4jsf library had with
outputPanel (and Ajax-aware wrapper component). It had to let the author
specify and defaulted to a <div>. But composite components could have any
content, so we simply cannot assume.


>
>
>  > Otherwise, every time a newcomer creates a composite
>> > component that he/she wants to update with Ajax, they are going to going
>> > through this trial and error lesson.
>>
>> But they don't require it every time.
>>
>> They only require it if they want to update the entire component via ajax
>> by the component name (or, more sadly, @this), rather than subportions of
>> the component or the entire form, which I imagine would be a more common
>> case.  and if you want to render the entire composite component with ajax,
>> then yes, you just add <span blah></span> - or div, if you want the
>> component to be block mode.
>>
>
> Right.  This seems like it will be common enough that we should make some
> effort to get the word out how to address this issue (ie. doc this as a best
> practice).  We can evaluate whether JSF can provide a more elegant solution
> in 2.1.


I think the best place to state this is in section 3.6.1.5, "Walk through of
the run-time for the simple composite component example", perhaps in bullet
#2.

"Despite the fact that the composite component is a NamingContainer and is
assigned an id in the component tree, the composite component renderer does
not automatically associate this id with an HTML element. It's the component
author's responsibility to explicitly select and associate the id with a
child element (i.e. <div id="#{cc.clientId}) in the composite component
template. For instance, inspecting the source for the login panel will
reveal that the id "loginPanel" is not present."


>
>
>
>  Otherwise, every time a newcomer creates a composite
>>
>>> component that he/she wants to update with Ajax, they are going to going
>>> through this trial and error lesson.
>>>
>>
>> I can't imagine that that confusion would last longer than the very first
>> example, would it?  For me, it didn't get past the first time I used view
>> source.   I got as far as "oh, it doesn't output anything unless I tell it
>> to", and that wasn't hard to understand.
>>
>
> Sure, but as I've heard Dan mention in some thread recently (or was it this
> thread?)... it is often these subtle little issues that cause frustration
> and disillusionment with the platform, so if we can help to clarify this in
> some way that will help our end users avoid the issue in the first place, it
> is a good thing.


Amen brother.

I believe if we at least mention it in the document somewhere (my suggestion
above), then us technical writers will highlight this best practice in
articles, blogs, and podcasts, and soon enough it will become common
knowledge. Without the documentation, you either a) think you found a hole
in the design, or b) went through a lot of pain to discover something we
already knew but just never said.

-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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20090525/5401fff7/attachment.html 


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