You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Daniel Reznick (JIRA)" <de...@myfaces.apache.org> on 2012/05/10 22:46:51 UTC

[jira] [Created] (MYFACES-3546)
Daniel Reznick created MYFACES-3546:
---------------------------------------

             Summary: <h:outputScript is not being loaded when located in ui:include that is initially rendered="false"
                 Key: MYFACES-3546
                 URL: https://issues.apache.org/jira/browse/MYFACES-3546
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.1.7, 2.0.11
         Environment: Windows / Tomcat 6
            Reporter: Daniel Reznick


Hi

I'm trying to load some heavy js file only after a user have clicked on button

so basically when user loads the main page there is a hidden page inside <ui:include

     <h:body>
        <h:form>
            <h:commandButton value="ClickMe" action="#{myBean.callme()}" >
                <f:ajax render="includeWrapper"></f:ajax>
            </h:commandButton>
            <h:panelGroup id="includeWrapper">
                wrapper
                <h:panelGroup rendered="#{myBean.show}">
                    <ui:include src="/page2.xhtml"></ui:include>
                </h:panelGroup>
            </h:panelGroup>
        </h:form>
    </h:body>


that hidden page got <h:outputScript that should be rendered when  user will click on the commandButton


page2.xhtml looks like this

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core">


    #{myBean.show}
    <h:outputScript library="js" name="myscript.js" rendered="#{myBean.show}"/>
    Woooow
</ui:composition>


and my callme looks like this

    public void callme(){
        show = !show;
        System.out.println("caaaaaaaaaaaal me\t"+show);
    }

This works perfectly in my mojarra sandbox , but for some reason it is not being loaded in my Myfaces 2.0.11 application I even tried the latest 2.1.8 snapshot


After I click on the show button and the script was supposed to be loaded , it gets loaded if I click F5 / Ctrl + F5 / or hit Enter in the URL of the browser... 

Thanks ahead.

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

Leonardo Uribe resolved MYFACES-3546.
-------------------------------------

    Resolution: Cannot Reproduce
      Assignee: Leonardo Uribe

I tried to reproduce it without success. This is the ajax received from the server after the operation:

<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update id="j_id_8:includeWrapper"><![CDATA[<span id="j_id_8:includeWrapper">
                wrapper
                

    true
    <script type="text/javascript" src="/javax.faces.resource/myscript.js.jsf?ln=js"><!--

//--></script>
    Woooow
</span>]]></update><update id="javax.faces.ViewState"><![CDATA[E1cN35AhyYqoUnCfCXj6NTfTSP7lo2n40GMR2oEP7wZoMn2LbrxwsaoN9GhpELo+lR/N1KzV9WoRlPoGoEGgzhYk1qfuUJ0xUE39wksonQCHLVB/Wqg25DZ59ps8bEiv9/iljQ==]]></update></changes></partial-response>

It is correct. The script is sent back to the client and then, jsf.js javascript process it and load it. If everything is in place it works. I tried it with Firefox 12, IE 9 and Chrome. 

I'll close this issue as cannot reproduce. Everything looks correct for me.
                
> <h:outputScript is not being loaded when located in ui:include that is initially rendered="false"
> -------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3546
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.0.11, 2.1.7
>         Environment: Windows / Tomcat 6
>            Reporter: Daniel Reznick
>            Assignee: Leonardo Uribe
>
> Hi
> I'm trying to load some heavy js file only after a user have clicked on button
> so basically when user loads the main page there is a hidden page inside <ui:include
>      <h:body>
>         <h:form>
>             <h:commandButton value="ClickMe" action="#{myBean.callme()}" >
>                 <f:ajax render="includeWrapper"></f:ajax>
>             </h:commandButton>
>             <h:panelGroup id="includeWrapper">
>                 wrapper
>                 <h:panelGroup rendered="#{myBean.show}">
>                     <ui:include src="/page2.xhtml"></ui:include>
>                 </h:panelGroup>
>             </h:panelGroup>
>         </h:form>
>     </h:body>
> that hidden page got <h:outputScript that should be rendered when  user will click on the commandButton
> page2.xhtml looks like this
> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
>     xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
>     xmlns:c="http://java.sun.com/jsp/jstl/core">
>     #{myBean.show}
>     <h:outputScript library="js" name="myscript.js" rendered="#{myBean.show}"/>
>     Woooow
> </ui:composition>
> and my callme looks like this
>     public void callme(){
>         show = !show;
>         System.out.println("caaaaaaaaaaaal me\t"+show);
>     }
> This works perfectly in my mojarra sandbox , but for some reason it is not being loaded in my Myfaces 2.0.11 application I even tried the latest 2.1.8 snapshot
> After I click on the show button and the script was supposed to be loaded , it gets loaded if I click F5 / Ctrl + F5 / or hit Enter in the URL of the browser... 
> Thanks ahead.

--
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-3546) Posted by "Daniel Reznick (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13276614#comment-13276614 ] 

Daniel Reznick commented on MYFACES-3546:
-----------------------------------------

did you see the js file being loaded in the firebug ? and did the alert pop up appears ? cause wit mojarra I do see the js file being loaded in the browser and the alert that inside that js being shown up... while with myfaces I don't...
                
> <h:outputScript is not being loaded when located in ui:include that is initially rendered="false"
> -------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3546
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3546
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.0.11, 2.1.7
>         Environment: Windows / Tomcat 6
>            Reporter: Daniel Reznick
>            Assignee: Leonardo Uribe
>
> Hi
> I'm trying to load some heavy js file only after a user have clicked on button
> so basically when user loads the main page there is a hidden page inside <ui:include
>      <h:body>
>         <h:form>
>             <h:commandButton value="ClickMe" action="#{myBean.callme()}" >
>                 <f:ajax render="includeWrapper"></f:ajax>
>             </h:commandButton>
>             <h:panelGroup id="includeWrapper">
>                 wrapper
>                 <h:panelGroup rendered="#{myBean.show}">
>                     <ui:include src="/page2.xhtml"></ui:include>
>                 </h:panelGroup>
>             </h:panelGroup>
>         </h:form>
>     </h:body>
> that hidden page got <h:outputScript that should be rendered when  user will click on the commandButton
> page2.xhtml looks like this
> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
>     xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
>     xmlns:c="http://java.sun.com/jsp/jstl/core">
>     #{myBean.show}
>     <h:outputScript library="js" name="myscript.js" rendered="#{myBean.show}"/>
>     Woooow
> </ui:composition>
> and my callme looks like this
>     public void callme(){
>         show = !show;
>         System.out.println("caaaaaaaaaaaal me\t"+show);
>     }
> This works perfectly in my mojarra sandbox , but for some reason it is not being loaded in my Myfaces 2.0.11 application I even tried the latest 2.1.8 snapshot
> After I click on the show button and the script was supposed to be loaded , it gets loaded if I click F5 / Ctrl + F5 / or hit Enter in the URL of the browser... 
> Thanks ahead.

--
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