users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: [1111-PassThruElements] DISCUSSION

From: Frank Caputo <frank_at_frankcaputo.de>
Date: Mon, 4 Jun 2012 18:20:33 +0200

Hello EG,

this email has 3 SECTIONS. Find the proposal at the end.


SECTION: Answer to Ed's question.

I can answer the question with a simple example. Suppose the following simple form where you have a dynamic fieldset and a dynamic legend rendered on ajax requests.

<h:form>
        <fieldset name="twoFields" id="twoFields">
            <legend id="legend">#{bean.legend}</legend>
            <h:inputText value="#{bean.text}">
                <f:ajax execute="@this" render="legend" event="keyup"/>
            </h:inputText>
            <h:inputSecret value="#{bean.secret}">
                <f:ajax execute="@this" render="twoFields" event="blur"/>
            </h:inputSecret>
        </fieldset>
</h:form>

If we added an attribute elementName to the panelGroup, we could convert the fieldset to <fieldset name="twoFields" id="twoFields" jsfc="h:panelGroup" elementName="fieldset"> and the legend to <legend id="legend" jsfc="h:panelGroup" elementName="legend">.

If we wanted to do this with composite components, we would have to write 2 composite components, which would be quite complex, to achieve this simple behavior.

Since the generic dynamic element behaves exactly the same like the panelGroup, I still propose to simply add the attribute elementName to h:panelGroup.

I think, this is a very simple change, having the passthru attributes, and gives the HTML developers a good experience.


SECTION: alternative

We could do copy and paste and invent a new element which behaves like h:panelGroup with an additional attribute elementName.


SECTION: proposal

1. Add the attribute elementName to the VDL doc of h:panelGroup with the following constraints:
- name: elementName
- required: false
- request-time: false
- type: javax.el.ValueExpression (must evaluate to java.lang.String)
- description: The name of the rendered HTML element. If layout is also specified, elementName takes priority.


Cheers,
Frank


Am 31.05.2012 um 00:05 schrieb Edward Burns:

> Hello Experts,
>
> I've had a hard time following the discussion on passthru elements,
> mainly because I was trying to *not* follow it because I was trying to
> make progress on passthru attributes. To save all of us time, I
> nominate Frank Caputo to craft a cohesive and self-contained proposal,
> IF he can answer this question. Why do we need pass through elements in
> the first place when you can do something like this?
>
> Using page:
>
> <my:componentUsingHtml5 a="b" c="#{d.e}">
> <f:actionListener binding="#{d.f}" />
> </my:componentUsingHtml5>
>
> Defining page:
>
> <cc:interface componentType="javaTopLevelComponent">
> <cc:actionListener ...>
> <cc:attribute >
> ...
> </cc:interface>
>
> <cc:implementation>
>
> arbitrary html 5 capable content goes here.
>
> </cc:implementation>
>
> I'd say that if the composite component feature is not up to the task,
> then we should improve it rather than inventing more syntax and giving
> our detractors more reason to say we're too complex.
>
> Sincerely,
>
> Ed
>
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | homepage: | http://ridingthecrest.com/
> | 31 Business days til JSF 2.2 Public Review to EG
>