You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Koci Martin <ma...@aura.cz> on 2005/04/27 20:28:24 UTC

JSF RI to MyFaces switch and problem

Hi,
I recently switch my project from JSF RI to MyFaces. The are three 
problem but one is major: when "cancelling" h:form with inputTexts 
elements with commandButton immediate="true" attr. submittedValue in 
UIInput is set to submitted values in HTTP request. This is OK but when 
rendering again  - submittedValue in UIInput are used for output in 
renderer, not values from model binded with value="#{}"!

I found this in RenderUtils (used in HtmlTextRendererBase.renderInput 
method):

if (component instanceof EditableValueHolder)  {
                Object submittedValue = 
((EditableValueHolder)component).getSubmittedValue();
                if (submittedValue != null) { 
<<<<<---------------------- if submitted value exists it's used for 
rendering instead  of value returned by ValueHolder.getValue()
                    if (submittedValue instanceof String) {
                        return (String)submittedValue;
                    }
                    else
                    {
                        throw new IllegalArgumentException("Expected 
submitted value of type String for component : "  
+getPathToComponent(component));
                    }
                }
            }

Everything works fine when submitting form with "not immediate" button 
because submitted values are set to null in UIInput.validate method 
after validation.

Is that behavior ok or I've missed something?

Thanks

Martin



Re: JSF RI to MyFaces switch and problem

Posted by Grant Smith <gr...@marathon-man.com>.
Koci,

could you please get the latest nightly build and see if your problem is 
resolved. MYFACES-187 should resolve this - if it doesn't, please let me 
know.

Thanks,
Grant.

Koci Martin wrote:

> Hi,
> I recently switch my project from JSF RI to MyFaces. The are three 
> problem but one is major: when "cancelling" h:form with inputTexts 
> elements with commandButton immediate="true" attr. submittedValue in 
> UIInput is set to submitted values in HTTP request. This is OK but 
> when rendering again  - submittedValue in UIInput are used for output 
> in renderer, not values from model binded with value="#{}"!
>
> I found this in RenderUtils (used in HtmlTextRendererBase.renderInput 
> method):
>
> if (component instanceof EditableValueHolder)  {
>                Object submittedValue = 
> ((EditableValueHolder)component).getSubmittedValue();
>                if (submittedValue != null) { 
> <<<<<---------------------- if submitted value exists it's used for 
> rendering instead  of value returned by ValueHolder.getValue()
>                    if (submittedValue instanceof String) {
>                        return (String)submittedValue;
>                    }
>                    else
>                    {
>                        throw new IllegalArgumentException("Expected 
> submitted value of type String for component : "  
> +getPathToComponent(component));
>                    }
>                }
>            }
>
> Everything works fine when submitting form with "not immediate" button 
> because submitted values are set to null in UIInput.validate method 
> after validation.
>
> Is that behavior ok or I've missed something?
>
> Thanks
>
> Martin
>
>
>
>