myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3896) AjaxHandler does not consider UserTagHandler as wrapped elements
Date Fri, 23 May 2014 10:52:01 GMT


Leonardo Uribe commented on MYFACES-3896:

This is a case that could raise some controversy, but I consider the behavior described is
expected. The reason for that is the "encapsulation" principle. 

With the ui:include tag you say "... include this part of the page in this place ...", but
for a ui:include the developer is on the same context, in this case in the web application,
so he/she knows what is inside the file and how f:ajax will affect the inner components. In
MyFaces syntax, ui:include creates a different template context, so any <ui:define ...>
declaration outside the component will not be taken into account for what's inside ui:include,
but you expect f:ajax to work in that case. If you need to use the same template context,
the best is use ui:decorate component.

But with the facelets user tag component, or with a composite component, you shouldn't know
what is inside the component. It could be some input, it could be a button or it could be
something else, so in this case there is no way to establish a relationship between what's
outside and what's inside without declare it in a explicit way. Allow code like that is broken
design, because if you change what's inside the component, the page with the f:ajax would
probably stop working. But, for example in a composite component you can use <cc:clientBehavior
event="..." ...> tag and fix the problem. That will be stable.

Historically, JSF 2 composite components where created to solve a requeriment from facelets
1.1.x. In that time, people created components using a user facelet tag, but the problem was
that you cannot define the property types or some other complex relationships like the events,
the validation, the actionListeneers and so on. So my suggestion is try to use a composite
component for this stuff. Unfortunately I do not think it is a good idea to change the code.
Instead, I suggest you to try to refactor your code in a way that you don't need the f:ajax
wrapper in that case.

> AjaxHandler does not consider UserTagHandler as wrapped elements
> ----------------------------------------------------------------
>                 Key: MYFACES-3896
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Sven Linstaedt
> When I include a facelet file via ui:include I can wrap the file in a f:ajax tag, in
order to apply the behavior to all children of the file.
> When I move to file to it's own tag using an taglib, this does not work any more and
myfaces is complaining about undefined eventNames. The reason for this is that the UserTagHandler
is not considered as a valid child for wrapped f:ajax tags, but the IncludeHandler is.
> Works:
> {code}
> ...
> <f:ajax render="@all">
> 	<ui:include src="/file/with/inputComponents.xhtml" />
> </f:ajax>
> ...
> {code}
> Does not work:
> {code}
> ...
> <f:ajax render="@all">
> 	<custom:fileWithInputComponents />
> </f:ajax>
> ...
> {code}

This message was sent by Atlassian JIRA

View raw message