You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Lukas Fryc (Created) (JIRA)" <de...@myfaces.apache.org> on 2012/03/26 20:36:28 UTC

[jira] [Created] (MYFACES-3513) Invalid chaining of client behavior scripts when using both, explicitly provided event and default event

Invalid chaining of client behavior scripts when using both, explicitly provided event and default event
--------------------------------------------------------------------------------------------------------

                 Key: MYFACES-3513
                 URL: https://issues.apache.org/jira/browse/MYFACES-3513
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.1.5
            Reporter: Lukas Fryc


When two client behaviors are provided and one uses default event while second has event provided

{code:XML|title=behavior-test.xhtml}
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:fryc="http://fryc.eu/behavior">
<h:body>
    <h:inputText>
        <f:ajax event="change" />
        <fryc:behavior1 />
    </h:inputText>
</h:body>
</html>
{code}

these scripts are chained wrong:

{code:XML|title=output}
<input id="j_id_3" name="j_id_3" type="text" value="" onchange="jsf.util.chain(document.getElementById('j_id_3'), event,'jsf.ajax.request(\'j_id_3\',event,{\'javax.faces.behavior.event\':\'change\'})''alert(\'xyz\')'); return false;" />
{code}


Follows source code for additional behavior:

{code:java|title=Behavior1.java}
@FacesBehavior("eu.fryc.Behavior1")
public class Behavior1 extends ClientBehaviorBase {
    
    @Override
    public String getScript(ClientBehaviorContext behaviorContext) {
        return "alert('xyz')";
    }
}
{code}
{code:xml|title=META-INF/fryc.taglib.xml}
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
    version="2.0">

    <namespace>http://fryc.eu/behavior</namespace>
    <tag>
        <tag-name>behavior1</tag-name>
        <behavior>
            <behavior-id>eu.fryc.Behavior1</behavior-id>
        </behavior>
    </tag>
</facelet-taglib>
{code}


----

Note that if you provide events explicitly for both behaviors (or not provide events at all), chaining works as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MYFACES-3513) Invalid chaining of client behavior scripts when using both, explicitly provided event and default event

Posted by "Lukas Fryc (Commented) (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-3513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244033#comment-13244033 ] 

Lukas Fryc commented on MYFACES-3513:
-------------------------------------

Thanks for the prompt fix, Leonard!
                
> Invalid chaining of client behavior scripts when using both, explicitly provided event and default event
> --------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3513
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3513
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.5
>            Reporter: Lukas Fryc
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.13, 2.1.7
>
>
> When two client behaviors are provided and one uses default event while second has event provided
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
>     xmlns:fryc="http://fryc.eu/behavior">
> <h:body>
>     <h:inputText>
>         <f:ajax event="change" />
>         <fryc:behavior1 />
>     </h:inputText>
> </h:body>
> </html>
> these scripts are chained wrong:
> <input id="j_id_3" name="j_id_3" type="text" value="" onchange="jsf.util.chain(document.getElementById('j_id_3'), event,'jsf.ajax.request(\'j_id_3\',event,{\'javax.faces.behavior.event\':\'change\'})''alert(\'xyz\')'); return false;" />
> Note there is no space between quotes before alert: ...''alert(\'xyz\')'); return false;" />
> -------------------------
> There is source code for additional behavior:
> @FacesBehavior("eu.fryc.Behavior1")
> public class Behavior1 extends ClientBehaviorBase {
>     
>     @Override
>     public String getScript(ClientBehaviorContext behaviorContext) {
>         return "alert('xyz')";
>     }
> }
> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
>     version="2.0">
>     <namespace>http://fryc.eu/behavior</namespace>
>     <tag>
>         <tag-name>behavior1</tag-name>
>         <behavior>
>             <behavior-id>eu.fryc.Behavior1</behavior-id>
>         </behavior>
>     </tag>
> </facelet-taglib>
> -------------------------
> Note that if you provide events explicitly for both behaviors (or not provide events at all), chaining works as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MYFACES-3513) Invalid chaining of client behavior scripts when using both, explicitly provided event and default event

Posted by "Leonardo Uribe (Resolved) (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-3513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3513.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.7
                   2.0.13
         Assignee: Leonardo Uribe

Thanks for the example. It helps a lot to debug and fix it quickly. The code that builds the behavior change is using the same buffer for both behaviors. The solution is use another buffer and add it to the final chain.
                
> Invalid chaining of client behavior scripts when using both, explicitly provided event and default event
> --------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3513
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3513
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.5
>            Reporter: Lukas Fryc
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.13, 2.1.7
>
>
> When two client behaviors are provided and one uses default event while second has event provided
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
>     xmlns:fryc="http://fryc.eu/behavior">
> <h:body>
>     <h:inputText>
>         <f:ajax event="change" />
>         <fryc:behavior1 />
>     </h:inputText>
> </h:body>
> </html>
> these scripts are chained wrong:
> <input id="j_id_3" name="j_id_3" type="text" value="" onchange="jsf.util.chain(document.getElementById('j_id_3'), event,'jsf.ajax.request(\'j_id_3\',event,{\'javax.faces.behavior.event\':\'change\'})''alert(\'xyz\')'); return false;" />
> Note there is no space between quotes before alert: ...''alert(\'xyz\')'); return false;" />
> -------------------------
> There is source code for additional behavior:
> @FacesBehavior("eu.fryc.Behavior1")
> public class Behavior1 extends ClientBehaviorBase {
>     
>     @Override
>     public String getScript(ClientBehaviorContext behaviorContext) {
>         return "alert('xyz')";
>     }
> }
> <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
>     version="2.0">
>     <namespace>http://fryc.eu/behavior</namespace>
>     <tag>
>         <tag-name>behavior1</tag-name>
>         <behavior>
>             <behavior-id>eu.fryc.Behavior1</behavior-id>
>         </behavior>
>     </tag>
> </facelet-taglib>
> -------------------------
> Note that if you provide events explicitly for both behaviors (or not provide events at all), chaining works as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira