webtier@glassfish.java.net

Re: f:actionListener for composite bug?

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Tue, 24 Feb 2009 12:38:19 -0800

>>>>> On Tue, 24 Feb 2009 09:13:20 -0700, David Geary <david.mark.geary_at_gmail.com> said:

>> <ez:loginButton>
>>  <f:actionListener for="loginAction" />

DG> This needs a type or binding attribute, correct?

Ahh, thanks. I have fixed the docs.

>> </ez:loginButton>
>> loginButton.xhtml
>>
>> <composite:interface>
>>  <composite:actionSource name="button" targets="form:button" />
>> </composite:interface>
>>
>> <composite:implementation>
>>
>>  <h:form id="form">
>>    <h:commandButton id="button" value="Submit" />
>>  </h:form>
>> </composite:implementation>

DG> Where is loginAction in the defining page? If this is from the
DG> tlddocs, as you indicate above, I think it's confusing.

Thanks, should be "button". I've fixed it.

>> Because the button on line 8 resides within a form, it must be referred
>> to using the "targets" attribute on line 2. Simply using the "name"
>> attribute is not sufficient because "name" is always interprented as a
>> simple component id, whereas the elements of the "targets" attribute are
>> interpreted as client ids, relative to the top level component.

DG> But with the build that I'm using (the one you sent me, Ryan), this works:

DG> Defining page:

DG> <composite:interface>
DG> <composite:actionSource name="form:loginAction"/>
DG> </composite:interface>

DG> Using page:

DG> <f:actionListener for="form:loginAction"
DG> type="com.corejsf.LoginActionListener" />

DG> Here, the name is not just a simple component id.

Sure, it works with "name" but you wouldn't want to publish
"form:loginAction" as an attached object target? I mean, you could, but
it would be not as nice as publishing something cleaner as "name" and
using "targets" to specifically point to the inner component.

Ed

-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://ridingthecrest.com/