You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Delbecq <de...@oma.be> on 2007/10/10 16:17:44 UTC

curious decode problem

Hello community,

I have a curious decode problem with myfaces:


First, i submit a form, with custom component. One form entry is
invalid. Custom component decode() gets called, then it's
getConvertedValue(), whcih throws a ConvertException. JSF properly
redisplay form, with submitted values, and the conversion error message

At second step:
I fix my value (remove letters in a decimal type field) and submit.
At that point, for reasons i couldn't explain, the JSF threat this like
a request for a new view instead of a restore view. As such, decode() is
not called, and all the values are taken back from my backing bean,
invalidation everything user submitted. I added a classical
<h:inputText> field linked to a backing bean String value, this one
shows same behaviour (reset to backing bean instead of applying user
submitted value).

Can someone explain me whyn after throwin a ConverterException from
getConvertedValue() the view gets invalidaed by JSF?

Thanks a lot, am out of ideas to locate problem...


For information:

extract of jsf form:

<h:form id="parameterTestForm" enctype="multipart/form-data">
          <s:parameter popupDocument="/select.jsp"
value="#{parameterTestBean.parameters[0]}" id="myArray"/>
          (Parameter 0 value is
#{parameterTestBean.parameters[0].value}, name is 
#{parameterTestBean.parameters[0].name})
          <br/>
.....
          <h:inputText id="marker"
value="#{parameterTestBean.parameters[8].name}"/> ....
#{parameterTestBean.parameters[8].name}
          <br/>
          <h:commandButton value="test" action="test" id="test"/>
      </h:form>


-- 
http://www.devlog.be (a belgian developer's logs)



Re: curious decode problem

Posted by David Delbecq <de...@oma.be>.
Never mind, located problem. Facelets was trying to serialize my view,
one component value had serialization issue. Because log4j was not
properly configured, myfaces didn't show any error message. After
configuring log4j to debug level, i got the serialization exception
stacktrace in logs and could fix issue.

En l'instant précis du 10/10/07 16:17, David Delbecq s'exprimait en ces
termes:
> Hello community,
>
> I have a curious decode problem with myfaces:
>
>
> First, i submit a form, with custom component. One form entry is
> invalid. Custom component decode() gets called, then it's
> getConvertedValue(), whcih throws a ConvertException. JSF properly
> redisplay form, with submitted values, and the conversion error message
>
> At second step:
> I fix my value (remove letters in a decimal type field) and submit.
> At that point, for reasons i couldn't explain, the JSF threat this like
> a request for a new view instead of a restore view. As such, decode() is
> not called, and all the values are taken back from my backing bean,
> invalidation everything user submitted. I added a classical
> <h:inputText> field linked to a backing bean String value, this one
> shows same behaviour (reset to backing bean instead of applying user
> submitted value).
>
> Can someone explain me whyn after throwin a ConverterException from
> getConvertedValue() the view gets invalidaed by JSF?
>
> Thanks a lot, am out of ideas to locate problem...
>
>
> For information:
>
> extract of jsf form:
>
> <h:form id="parameterTestForm" enctype="multipart/form-data">
>           <s:parameter popupDocument="/select.jsp"
> value="#{parameterTestBean.parameters[0]}" id="myArray"/>
>           (Parameter 0 value is
> #{parameterTestBean.parameters[0].value}, name is 
> #{parameterTestBean.parameters[0].name})
>           <br/>
> ....
>           <h:inputText id="marker"
> value="#{parameterTestBean.parameters[8].name}"/> ....
> #{parameterTestBean.parameters[8].name}
>           <br/>
>           <h:commandButton value="test" action="test" id="test"/>
>       </h:form>
>
>
>   


-- 
http://www.devlog.be (a belgian developer's logs)



Re: curious decode problem

Posted by David Delbecq <de...@oma.be>.
This was a serialization problem of my custom component's value. This,
happened only when one of my custom components had a local value, that
is only when another component in same form failed validation.
Serialization exception led Facelet to abandon the view.
En l'instant précis du 11/10/07 09:27, Martin Marinschek s'exprimait en
ces termes:
> Very interesting - wouldn't see what would cause this. Can you debug
> through the first phase of JSF (restore-view) to see what happens?
>
> In the end, the state will be restored if you do have a
> javax.faces.ViewState parameter send along, and this parameter can
> properly be decrypted into an object-tree.
>
> Exception: you might have a phase-listener configured which does something else?
>
> regards,
>
> Martin
>
> On 10/10/07, David Delbecq <de...@oma.be> wrote:
>   
>> Hello community,
>>
>> I have a curious decode problem with myfaces:
>>
>>
>> First, i submit a form, with custom component. One form entry is
>> invalid. Custom component decode() gets called, then it's
>> getConvertedValue(), whcih throws a ConvertException. JSF properly
>> redisplay form, with submitted values, and the conversion error message
>>
>> At second step:
>> I fix my value (remove letters in a decimal type field) and submit.
>> At that point, for reasons i couldn't explain, the JSF threat this like
>> a request for a new view instead of a restore view. As such, decode() is
>> not called, and all the values are taken back from my backing bean,
>> invalidation everything user submitted. I added a classical
>> <h:inputText> field linked to a backing bean String value, this one
>> shows same behaviour (reset to backing bean instead of applying user
>> submitted value).
>>
>> Can someone explain me whyn after throwin a ConverterException from
>> getConvertedValue() the view gets invalidaed by JSF?
>>
>> Thanks a lot, am out of ideas to locate problem...
>>
>>
>> For information:
>>
>> extract of jsf form:
>>
>> <h:form id="parameterTestForm" enctype="multipart/form-data">
>>           <s:parameter popupDocument="/select.jsp"
>> value="#{parameterTestBean.parameters[0]}" id="myArray"/>
>>           (Parameter 0 value is
>> #{parameterTestBean.parameters[0].value}, name is
>> #{parameterTestBean.parameters[0].name})
>>           <br/>
>> .....
>>           <h:inputText id="marker"
>> value="#{parameterTestBean.parameters[8].name}"/> ....
>> #{parameterTestBean.parameters[8].name}
>>           <br/>
>>           <h:commandButton value="test" action="test" id="test"/>
>>       </h:form>
>>
>>
>> --
>> http://www.devlog.be (a belgian developer's logs)
>>
>>
>>
>>     
>
>
>   


-- 
http://www.devlog.be (a belgian developer's logs)



Re: curious decode problem

Posted by Martin Marinschek <ma...@gmail.com>.
Very interesting - wouldn't see what would cause this. Can you debug
through the first phase of JSF (restore-view) to see what happens?

In the end, the state will be restored if you do have a
javax.faces.ViewState parameter send along, and this parameter can
properly be decrypted into an object-tree.

Exception: you might have a phase-listener configured which does something else?

regards,

Martin

On 10/10/07, David Delbecq <de...@oma.be> wrote:
> Hello community,
>
> I have a curious decode problem with myfaces:
>
>
> First, i submit a form, with custom component. One form entry is
> invalid. Custom component decode() gets called, then it's
> getConvertedValue(), whcih throws a ConvertException. JSF properly
> redisplay form, with submitted values, and the conversion error message
>
> At second step:
> I fix my value (remove letters in a decimal type field) and submit.
> At that point, for reasons i couldn't explain, the JSF threat this like
> a request for a new view instead of a restore view. As such, decode() is
> not called, and all the values are taken back from my backing bean,
> invalidation everything user submitted. I added a classical
> <h:inputText> field linked to a backing bean String value, this one
> shows same behaviour (reset to backing bean instead of applying user
> submitted value).
>
> Can someone explain me whyn after throwin a ConverterException from
> getConvertedValue() the view gets invalidaed by JSF?
>
> Thanks a lot, am out of ideas to locate problem...
>
>
> For information:
>
> extract of jsf form:
>
> <h:form id="parameterTestForm" enctype="multipart/form-data">
>           <s:parameter popupDocument="/select.jsp"
> value="#{parameterTestBean.parameters[0]}" id="myArray"/>
>           (Parameter 0 value is
> #{parameterTestBean.parameters[0].value}, name is
> #{parameterTestBean.parameters[0].name})
>           <br/>
> .....
>           <h:inputText id="marker"
> value="#{parameterTestBean.parameters[8].name}"/> ....
> #{parameterTestBean.parameters[8].name}
>           <br/>
>           <h:commandButton value="test" action="test" id="test"/>
>       </h:form>
>
>
> --
> http://www.devlog.be (a belgian developer's logs)
>
>
>


-- 

http://www.irian.at

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

Professional Support for Apache MyFaces