You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Leonardo Uribe <lu...@gmail.com> on 2010/07/01 00:40:18 UTC

[extval] renderer wrappers break @ListenerFor annotation

Hi

In some cases, extval wraps renders but that has a side effect: all
renderers annotated with @ListenerFor are not registered properly. That
means h:outputScript / h:outputStylesheet stop working and there are not
relocated anymore.

So if you have a page like this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:composite="http://java.sun.com/jsf/composite"
 >
<h:head>
</h:head>
<h:body>
<h:form id="mainForm">
    <h:panelGrid columns="2">
        <h:outputLabel for="outname" value="Name: " />
        <h:inputText id="outname" value="#{helloWorld.name}"/>
        <h:outputLabel for="inname" value="Please enter your name" />
        <h:inputText id="inname" value="#{helloWorld.name}"/>
        <h:commandButton id="button1" type="button" value="Ajax Update">
            <f:ajax execute="mainForm" render="outname"/>
        </h:commandButton>
        <h:commandButton id="button2" value="Normal Submit"/>
        <h:messages showDetail="true" showSummary="false"/>
    </h:panelGrid>
</h:form>
</h:body>
</html>

With extval on the classpath, the script to be added on <head> by f:ajax tag
handler is not relocated. Reproduce it is very easy, just add to a existing
example this jars:

        <dependency>
            <groupId>org.apache.myfaces.extensions.validator</groupId>
            <artifactId>myfaces-extval-core</artifactId>
            <version>2.0.4-SNAPSHOT</version>
        </dependency>

        <dependency>

<groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
            <artifactId>myfaces-extval-bean-validation</artifactId>
            <version>2.0.4-SNAPSHOT</version>
        </dependency>

        <dependency>

<groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
            <artifactId>myfaces-extval-property-validation</artifactId>
            <version>2.0.4-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>

        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-validator</artifactId>
          <version>4.0.2.GA</version>
        </dependency>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>1.5.6</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.6</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <type>jar</type>
        </dependency>

The solution could be create some wrapper for Application object that takes
into account this case on ExtVal.

regards,

Leonardo Uribe

Re: [extval] renderer wrappers break @ListenerFor annotation

Posted by Gerhard Petracek <ge...@gmail.com>.
ok - so we have a simple workaround for it.

however, it looks like a myfaces-core2 issue. at least i can't reproduce the
issue in combination with mojarra2.
mojarra also uses the annotation (see ScriptStyleBaseRenderer).
imo we should check why it just happens in combination with myfaces-core2.

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


2010/7/1 Leonardo Uribe <lu...@gmail.com>

> Hi Gerhard
>
> I added generic support dependency and that solved the problem.
>
>         <dependency>
>
> <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
>             <artifactId>myfaces-extval-generic-support</artifactId>
>
>             <version>2.0.4-SNAPSHOT</version>
>         </dependency>
>
> regards,
>
> Leonardo Uribe
>
> 2010/6/30 Gerhard Petracek <ge...@gmail.com>
>
> hi leonardo,
>>
>> do you see the same issue with the generic support module of extval?
>>
>> regards,
>> gerhard
>>
>> http://www.irian.at
>>
>> Your JSF powerhouse -
>> JSF Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>>
>>
>> 2010/7/1 Leonardo Uribe <lu...@gmail.com>
>>
>> Hi
>>>
>>> In some cases, extval wraps renders but that has a side effect: all
>>> renderers annotated with @ListenerFor are not registered properly. That
>>> means h:outputScript / h:outputStylesheet stop working and there are not
>>> relocated anymore.
>>>
>>> So if you have a page like this:
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>  xmlns:h="http://java.sun.com/jsf/html"
>>>  xmlns:f="http://java.sun.com/jsf/core"
>>>  xmlns:composite="http://java.sun.com/jsf/composite"
>>>  >
>>> <h:head>
>>> </h:head>
>>> <h:body>
>>> <h:form id="mainForm">
>>>     <h:panelGrid columns="2">
>>>         <h:outputLabel for="outname" value="Name: " />
>>>         <h:inputText id="outname" value="#{helloWorld.name}"/>
>>>         <h:outputLabel for="inname" value="Please enter your name" />
>>>         <h:inputText id="inname" value="#{helloWorld.name}"/>
>>>         <h:commandButton id="button1" type="button" value="Ajax Update">
>>>             <f:ajax execute="mainForm" render="outname"/>
>>>         </h:commandButton>
>>>         <h:commandButton id="button2" value="Normal Submit"/>
>>>         <h:messages showDetail="true" showSummary="false"/>
>>>     </h:panelGrid>
>>> </h:form>
>>> </h:body>
>>> </html>
>>>
>>> With extval on the classpath, the script to be added on <head> by f:ajax
>>> tag handler is not relocated. Reproduce it is very easy, just add to a
>>> existing example this jars:
>>>
>>>         <dependency>
>>>             <groupId>org.apache.myfaces.extensions.validator</groupId>
>>>             <artifactId>myfaces-extval-core</artifactId>
>>>             <version>2.0.4-SNAPSHOT</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>
>>> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>>>             <artifactId>myfaces-extval-bean-validation</artifactId>
>>>             <version>2.0.4-SNAPSHOT</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>
>>> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>>>             <artifactId>myfaces-extval-property-validation</artifactId>
>>>             <version>2.0.4-SNAPSHOT</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>             <groupId>javax.validation</groupId>
>>>             <artifactId>validation-api</artifactId>
>>>             <version>1.0.0.GA</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>           <groupId>org.hibernate</groupId>
>>>           <artifactId>hibernate-validator</artifactId>
>>>           <version>4.0.2.GA</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>           <groupId>org.slf4j</groupId>
>>>           <artifactId>slf4j-api</artifactId>
>>>           <version>1.5.6</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>             <groupId>org.slf4j</groupId>
>>>             <artifactId>slf4j-log4j12</artifactId>
>>>             <version>1.5.6</version>
>>>         </dependency>
>>>
>>>         <dependency>
>>>             <groupId>log4j</groupId>
>>>             <artifactId>log4j</artifactId>
>>>             <version>${log4j.version}</version>
>>>             <type>jar</type>
>>>         </dependency>
>>>
>>> The solution could be create some wrapper for Application object that
>>> takes into account this case on ExtVal.
>>>
>>> regards,
>>>
>>> Leonardo Uribe
>>>
>>
>>
>

Re: [extval] renderer wrappers break @ListenerFor annotation

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi Gerhard

I added generic support dependency and that solved the problem.

        <dependency>

<groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
            <artifactId>myfaces-extval-generic-support</artifactId>
            <version>2.0.4-SNAPSHOT</version>
        </dependency>

regards,

Leonardo Uribe

2010/6/30 Gerhard Petracek <ge...@gmail.com>

> hi leonardo,
>
> do you see the same issue with the generic support module of extval?
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2010/7/1 Leonardo Uribe <lu...@gmail.com>
>
> Hi
>>
>> In some cases, extval wraps renders but that has a side effect: all
>> renderers annotated with @ListenerFor are not registered properly. That
>> means h:outputScript / h:outputStylesheet stop working and there are not
>> relocated anymore.
>>
>> So if you have a page like this:
>>
>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml"
>>  xmlns:h="http://java.sun.com/jsf/html"
>>  xmlns:f="http://java.sun.com/jsf/core"
>>  xmlns:composite="http://java.sun.com/jsf/composite"
>>  >
>> <h:head>
>> </h:head>
>> <h:body>
>> <h:form id="mainForm">
>>     <h:panelGrid columns="2">
>>         <h:outputLabel for="outname" value="Name: " />
>>         <h:inputText id="outname" value="#{helloWorld.name}"/>
>>         <h:outputLabel for="inname" value="Please enter your name" />
>>         <h:inputText id="inname" value="#{helloWorld.name}"/>
>>         <h:commandButton id="button1" type="button" value="Ajax Update">
>>             <f:ajax execute="mainForm" render="outname"/>
>>         </h:commandButton>
>>         <h:commandButton id="button2" value="Normal Submit"/>
>>         <h:messages showDetail="true" showSummary="false"/>
>>     </h:panelGrid>
>> </h:form>
>> </h:body>
>> </html>
>>
>> With extval on the classpath, the script to be added on <head> by f:ajax
>> tag handler is not relocated. Reproduce it is very easy, just add to a
>> existing example this jars:
>>
>>         <dependency>
>>             <groupId>org.apache.myfaces.extensions.validator</groupId>
>>             <artifactId>myfaces-extval-core</artifactId>
>>             <version>2.0.4-SNAPSHOT</version>
>>         </dependency>
>>
>>         <dependency>
>>
>> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>>             <artifactId>myfaces-extval-bean-validation</artifactId>
>>             <version>2.0.4-SNAPSHOT</version>
>>         </dependency>
>>
>>         <dependency>
>>
>> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>>             <artifactId>myfaces-extval-property-validation</artifactId>
>>             <version>2.0.4-SNAPSHOT</version>
>>         </dependency>
>>
>>         <dependency>
>>             <groupId>javax.validation</groupId>
>>             <artifactId>validation-api</artifactId>
>>             <version>1.0.0.GA</version>
>>         </dependency>
>>
>>         <dependency>
>>           <groupId>org.hibernate</groupId>
>>           <artifactId>hibernate-validator</artifactId>
>>           <version>4.0.2.GA</version>
>>         </dependency>
>>
>>         <dependency>
>>           <groupId>org.slf4j</groupId>
>>           <artifactId>slf4j-api</artifactId>
>>           <version>1.5.6</version>
>>         </dependency>
>>
>>         <dependency>
>>             <groupId>org.slf4j</groupId>
>>             <artifactId>slf4j-log4j12</artifactId>
>>             <version>1.5.6</version>
>>         </dependency>
>>
>>         <dependency>
>>             <groupId>log4j</groupId>
>>             <artifactId>log4j</artifactId>
>>             <version>${log4j.version}</version>
>>             <type>jar</type>
>>         </dependency>
>>
>> The solution could be create some wrapper for Application object that
>> takes into account this case on ExtVal.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>
>

Re: [extval] renderer wrappers break @ListenerFor annotation

Posted by Gerhard Petracek <ge...@gmail.com>.
hi leonardo,

do you see the same issue with the generic support module of extval?

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2010/7/1 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> In some cases, extval wraps renders but that has a side effect: all
> renderers annotated with @ListenerFor are not registered properly. That
> means h:outputScript / h:outputStylesheet stop working and there are not
> relocated anymore.
>
> So if you have a page like this:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>  xmlns:h="http://java.sun.com/jsf/html"
>  xmlns:f="http://java.sun.com/jsf/core"
>  xmlns:composite="http://java.sun.com/jsf/composite"
>  >
> <h:head>
> </h:head>
> <h:body>
> <h:form id="mainForm">
>     <h:panelGrid columns="2">
>         <h:outputLabel for="outname" value="Name: " />
>         <h:inputText id="outname" value="#{helloWorld.name}"/>
>         <h:outputLabel for="inname" value="Please enter your name" />
>         <h:inputText id="inname" value="#{helloWorld.name}"/>
>         <h:commandButton id="button1" type="button" value="Ajax Update">
>             <f:ajax execute="mainForm" render="outname"/>
>         </h:commandButton>
>         <h:commandButton id="button2" value="Normal Submit"/>
>         <h:messages showDetail="true" showSummary="false"/>
>     </h:panelGrid>
> </h:form>
> </h:body>
> </html>
>
> With extval on the classpath, the script to be added on <head> by f:ajax
> tag handler is not relocated. Reproduce it is very easy, just add to a
> existing example this jars:
>
>         <dependency>
>             <groupId>org.apache.myfaces.extensions.validator</groupId>
>             <artifactId>myfaces-extval-core</artifactId>
>             <version>2.0.4-SNAPSHOT</version>
>         </dependency>
>
>         <dependency>
>
> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>             <artifactId>myfaces-extval-bean-validation</artifactId>
>             <version>2.0.4-SNAPSHOT</version>
>         </dependency>
>
>         <dependency>
>
> <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
>             <artifactId>myfaces-extval-property-validation</artifactId>
>             <version>2.0.4-SNAPSHOT</version>
>         </dependency>
>
>         <dependency>
>             <groupId>javax.validation</groupId>
>             <artifactId>validation-api</artifactId>
>             <version>1.0.0.GA</version>
>         </dependency>
>
>         <dependency>
>           <groupId>org.hibernate</groupId>
>           <artifactId>hibernate-validator</artifactId>
>           <version>4.0.2.GA</version>
>         </dependency>
>
>         <dependency>
>           <groupId>org.slf4j</groupId>
>           <artifactId>slf4j-api</artifactId>
>           <version>1.5.6</version>
>         </dependency>
>
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>slf4j-log4j12</artifactId>
>             <version>1.5.6</version>
>         </dependency>
>
>         <dependency>
>             <groupId>log4j</groupId>
>             <artifactId>log4j</artifactId>
>             <version>${log4j.version}</version>
>             <type>jar</type>
>         </dependency>
>
> The solution could be create some wrapper for Application object that takes
> into account this case on ExtVal.
>
> regards,
>
> Leonardo Uribe
>