You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Daniel Reznick <ve...@gmail.com> on 2012/05/09 17:11:05 UTC

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

Is there any web.xml configuration that I'm missing

Thanks ahead,


Daniel.

Re: Posted by Daniel Reznick <ve...@gmail.com>.
Ok , Thanks

Opened...

https://issues.apache.org/jira/browse/MYFACES-3546



On Thu, May 10, 2012 at 11:15 AM, Werner Punz <we...@gmail.com> wrote:

> Hi, this looks like a bug to me, can you file a bugreport with an example
> on  https://issues.apache.org/**jira/browse/MYFACES<https://issues.apache.org/jira/browse/MYFACES>,
> so that
> the fix will make it into the next release.
>
> Werner
>
>
> Am 10.05.12 08:05, schrieb Daniel Reznick:
>
>  Forgot to add that 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 again.
>>
>> On Wed, May 9, 2012 at 6:11 PM, Daniel Reznick<ve...@gmail.com>  wrote:
>>
>>  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<http://www.w3.org/1999/xhtml>"
>>> xmlns:ui="
>>> http://java.sun.com/jsf/**facelets <http://java.sun.com/jsf/facelets>"
>>>     xmlns:h="http://java.sun.com/**jsf/html<http://java.sun.com/jsf/html>"
>>> xmlns:f="
>>> http://java.sun.com/jsf/core"
>>>     xmlns:c="http://java.sun.com/**jsp/jstl/core<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
>>>
>>> Is there any web.xml configuration that I'm missing
>>>
>>> Thanks ahead,
>>>
>>>
>>> Daniel.
>>>
>>>
>>
>
>

Re: Posted by Werner Punz <we...@gmail.com>.
Hi, this looks like a bug to me, can you file a bugreport with an 
example on  https://issues.apache.org/jira/browse/MYFACES, so that
the fix will make it into the next release.

Werner


Am 10.05.12 08:05, schrieb Daniel Reznick:
> Forgot to add that 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 again.
>
> On Wed, May 9, 2012 at 6:11 PM, Daniel Reznick<ve...@gmail.com>  wrote:
>
>> 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
>>
>> Is there any web.xml configuration that I'm missing
>>
>> Thanks ahead,
>>
>>
>> Daniel.
>>
>



Re: Posted by Daniel Reznick <ve...@gmail.com>.
Forgot to add that 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 again.

On Wed, May 9, 2012 at 6:11 PM, Daniel Reznick <ve...@gmail.com> wrote:

> 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
>
> Is there any web.xml configuration that I'm missing
>
> Thanks ahead,
>
>
> Daniel.
>