You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Quilleash <mi...@subexazure.com> on 2007/04/02 12:39:02 UTC

Saving component submitted values

Hi all,
 
My question put simply is: Does the value of submittedValue on a
UIInput/EditableValueHolder take precedence over the an actual value
when it comes to rendering the component?
 
 
Background:
 
I've been trying to find a way to save component values between
redirects.  I have a form with 2 input controls, one is a h:inputText
the other a custom component.  The custom component is a disabled input
text paired with a custom immediate command button.  The button takes
the user to another view where they can search and select an entity,
click ok and get redirected back to form page with the disabled input
text filled in.  This is all ok and works correctly.
 
The problem I have is other components' values in the form (like the
h:inputText in the example) will not be saved by default as I am not
doing a postback (and may not be valid yet).  So I'm wondering if the
following may work.
 
1) User enters (possibly invalid) value into the h:inputText.
2) User clicked button.
3) Submitted values (if present) of all components in the form are saved
(custom code).
4) Redirect to other page.
5) User makes selection on another page.
6) Redirect back to form page.
7) Submitted values restored to the form (custom code).
8) View renders.
 
I'm not sure in 8 whether the submitted value will be used or the actual
value (which is probably still null).  The JSF spec doesn't make it
clear whether the submitted value takes precedence for rendering if it
is set.
 
Any help or suggestions appreciated.
 
Cheers.
 
Mike.
 

 This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html


Re: Saving component submitted values

Posted by Simon Kitching <si...@rhe.co.nz>.
I'm quite sure it is in the spec though I don't remember quite where for 
the moment.

Don't forget that the official javadoc is also considered part of the 
spec. This was a bad decision IMO, but that's the way Sun sees it.

The javadoc for Renderer.encodeBegin says clearly that if conversion 
fails then submittedValue should be used:
  http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/index.html

I don't know exactly where it says that if any FacesMessages are 
registered then use the converted value, but I'm sure it's there somewhere.

Regards,

Simn


Martin Marinschek wrote:
> I would have thought the information is in the spec - if it is not, it
> should be added, yes. Could you possibly file a spec clarification
> issue?
> 
> regards,
> 
> Martin
> 
> On 4/2/07, Mike Kienenberger <mk...@gmail.com> wrote:
>> I'm not sure where it's documented.   Here's a couple more places to
>> look, although I didn't see it here.
>>
>> http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/
>>
>> Another authoritative source of information is the renderkitdocs.
>>
>> http://java.sun.com/javaee/javaserverfaces/1.1/docs/renderkitdocs/
>>
>> Try looking for UIInput or EditableValueHolder.
>>
>> On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
>> > Thanks, just the answer I wanted!
>> >
>> > I couldn't see this information explicitly in the spec anywhere, might
>> > be worth a clarification if I didn't miss anything.
>> >
>> > Cheers.
>> >
>> > Mike.
>> >
>> > -----Original Message-----
>> > From: Mike Kienenberger [mailto:mkienenb@gmail.com]
>> > Sent: 02 April 2007 15:43
>> > To: MyFaces Discussion
>> > Subject: Re: Saving component submitted values
>> >
>> > When rendering, the submitted value is used if non-null.
>> > Then the local value is used if it is set on the component.
>> > Then the backing bean model value is used.
>> >
>> >
>> > On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
>> > >
>> > >
>> > > Hi all,
>> > >
>> > > My question put simply is: Does the value of submittedValue on a
>> > > UIInput/EditableValueHolder take precedence over the an actual value
>> > > when it comes to rendering the component?
>> > >
>> > >
>> > > Background:
>> > >
>> > > I've been trying to find a way to save component values between
>> > redirects.
>> > > I have a form with 2 input controls, one is a h:inputText the other a
>> > > custom component.  The custom component is a disabled input text
>> > > paired with a custom immediate command button.  The button takes the
>> > > user to another view where they can search and select an entity, 
>> click
>> >
>> > > ok and get redirected back to form page with the disabled input text
>> > > filled in.  This is all ok and works correctly.
>> > >
>> > > The problem I have is other components' values in the form (like the
>> > > h:inputText in the example) will not be saved by default as I am not
>> > > doing a postback (and may not be valid yet).  So I'm wondering if the
>> > > following may work.
>> > >
>> > > 1) User enters (possibly invalid) value into the h:inputText.
>> > > 2) User clicked button.
>> > > 3) Submitted values (if present) of all components in the form are
>> > > saved (custom code).
>> > > 4) Redirect to other page.
>> > > 5) User makes selection on another page.
>> > > 6) Redirect back to form page.
>> > > 7) Submitted values restored to the form (custom code).
>> > > 8) View renders.
>> > >
>> > > I'm not sure in 8 whether the submitted value will be used or the
>> > > actual value (which is probably still null).  The JSF spec doesn't
>> > > make it clear whether the submitted value takes precedence for
>> > rendering if it is set.
>> > >
>> > > Any help or suggestions appreciated.
>> > >
>> > > Cheers.
>> > >
>> > > Mike.
>> > >   This e-mail is bound by the terms and conditions described at
>> > > http://www.subexazure.com/mail-disclaimer.html
>> > >
>> > >
>> > >
>> >
>> >
>> >  This e-mail is bound by the terms and conditions described at 
>> http://www.subexazure.com/mail-disclaimer.html
>> >
>> >
>>
> 
> 


Re: Saving component submitted values

Posted by Martin Marinschek <ma...@gmail.com>.
I would have thought the information is in the spec - if it is not, it
should be added, yes. Could you possibly file a spec clarification
issue?

regards,

Martin

On 4/2/07, Mike Kienenberger <mk...@gmail.com> wrote:
> I'm not sure where it's documented.   Here's a couple more places to
> look, although I didn't see it here.
>
> http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/
>
> Another authoritative source of information is the renderkitdocs.
>
> http://java.sun.com/javaee/javaserverfaces/1.1/docs/renderkitdocs/
>
> Try looking for UIInput or EditableValueHolder.
>
> On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
> > Thanks, just the answer I wanted!
> >
> > I couldn't see this information explicitly in the spec anywhere, might
> > be worth a clarification if I didn't miss anything.
> >
> > Cheers.
> >
> > Mike.
> >
> > -----Original Message-----
> > From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> > Sent: 02 April 2007 15:43
> > To: MyFaces Discussion
> > Subject: Re: Saving component submitted values
> >
> > When rendering, the submitted value is used if non-null.
> > Then the local value is used if it is set on the component.
> > Then the backing bean model value is used.
> >
> >
> > On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
> > >
> > >
> > > Hi all,
> > >
> > > My question put simply is: Does the value of submittedValue on a
> > > UIInput/EditableValueHolder take precedence over the an actual value
> > > when it comes to rendering the component?
> > >
> > >
> > > Background:
> > >
> > > I've been trying to find a way to save component values between
> > redirects.
> > > I have a form with 2 input controls, one is a h:inputText the other a
> > > custom component.  The custom component is a disabled input text
> > > paired with a custom immediate command button.  The button takes the
> > > user to another view where they can search and select an entity, click
> >
> > > ok and get redirected back to form page with the disabled input text
> > > filled in.  This is all ok and works correctly.
> > >
> > > The problem I have is other components' values in the form (like the
> > > h:inputText in the example) will not be saved by default as I am not
> > > doing a postback (and may not be valid yet).  So I'm wondering if the
> > > following may work.
> > >
> > > 1) User enters (possibly invalid) value into the h:inputText.
> > > 2) User clicked button.
> > > 3) Submitted values (if present) of all components in the form are
> > > saved (custom code).
> > > 4) Redirect to other page.
> > > 5) User makes selection on another page.
> > > 6) Redirect back to form page.
> > > 7) Submitted values restored to the form (custom code).
> > > 8) View renders.
> > >
> > > I'm not sure in 8 whether the submitted value will be used or the
> > > actual value (which is probably still null).  The JSF spec doesn't
> > > make it clear whether the submitted value takes precedence for
> > rendering if it is set.
> > >
> > > Any help or suggestions appreciated.
> > >
> > > Cheers.
> > >
> > > Mike.
> > >   This e-mail is bound by the terms and conditions described at
> > > http://www.subexazure.com/mail-disclaimer.html
> > >
> > >
> > >
> >
> >
> >  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
> >
> >
>


-- 

http://www.irian.at

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

Professional Support for Apache MyFaces

Re: Saving component submitted values

Posted by Mike Kienenberger <mk...@gmail.com>.
I'm not sure where it's documented.   Here's a couple more places to
look, although I didn't see it here.

http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/

Another authoritative source of information is the renderkitdocs.

http://java.sun.com/javaee/javaserverfaces/1.1/docs/renderkitdocs/

Try looking for UIInput or EditableValueHolder.

On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
> Thanks, just the answer I wanted!
>
> I couldn't see this information explicitly in the spec anywhere, might
> be worth a clarification if I didn't miss anything.
>
> Cheers.
>
> Mike.
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> Sent: 02 April 2007 15:43
> To: MyFaces Discussion
> Subject: Re: Saving component submitted values
>
> When rendering, the submitted value is used if non-null.
> Then the local value is used if it is set on the component.
> Then the backing bean model value is used.
>
>
> On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
> >
> >
> > Hi all,
> >
> > My question put simply is: Does the value of submittedValue on a
> > UIInput/EditableValueHolder take precedence over the an actual value
> > when it comes to rendering the component?
> >
> >
> > Background:
> >
> > I've been trying to find a way to save component values between
> redirects.
> > I have a form with 2 input controls, one is a h:inputText the other a
> > custom component.  The custom component is a disabled input text
> > paired with a custom immediate command button.  The button takes the
> > user to another view where they can search and select an entity, click
>
> > ok and get redirected back to form page with the disabled input text
> > filled in.  This is all ok and works correctly.
> >
> > The problem I have is other components' values in the form (like the
> > h:inputText in the example) will not be saved by default as I am not
> > doing a postback (and may not be valid yet).  So I'm wondering if the
> > following may work.
> >
> > 1) User enters (possibly invalid) value into the h:inputText.
> > 2) User clicked button.
> > 3) Submitted values (if present) of all components in the form are
> > saved (custom code).
> > 4) Redirect to other page.
> > 5) User makes selection on another page.
> > 6) Redirect back to form page.
> > 7) Submitted values restored to the form (custom code).
> > 8) View renders.
> >
> > I'm not sure in 8 whether the submitted value will be used or the
> > actual value (which is probably still null).  The JSF spec doesn't
> > make it clear whether the submitted value takes precedence for
> rendering if it is set.
> >
> > Any help or suggestions appreciated.
> >
> > Cheers.
> >
> > Mike.
> >   This e-mail is bound by the terms and conditions described at
> > http://www.subexazure.com/mail-disclaimer.html
> >
> >
> >
>
>
>  This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html
>
>

RE: Saving component submitted values

Posted by Mike Quilleash <mi...@subexazure.com>.
Thanks, just the answer I wanted! 

I couldn't see this information explicitly in the spec anywhere, might
be worth a clarification if I didn't miss anything.

Cheers.

Mike.

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: 02 April 2007 15:43
To: MyFaces Discussion
Subject: Re: Saving component submitted values

When rendering, the submitted value is used if non-null.
Then the local value is used if it is set on the component.
Then the backing bean model value is used.


On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
>
>
> Hi all,
>
> My question put simply is: Does the value of submittedValue on a 
> UIInput/EditableValueHolder take precedence over the an actual value 
> when it comes to rendering the component?
>
>
> Background:
>
> I've been trying to find a way to save component values between
redirects.
> I have a form with 2 input controls, one is a h:inputText the other a 
> custom component.  The custom component is a disabled input text 
> paired with a custom immediate command button.  The button takes the 
> user to another view where they can search and select an entity, click

> ok and get redirected back to form page with the disabled input text 
> filled in.  This is all ok and works correctly.
>
> The problem I have is other components' values in the form (like the 
> h:inputText in the example) will not be saved by default as I am not 
> doing a postback (and may not be valid yet).  So I'm wondering if the 
> following may work.
>
> 1) User enters (possibly invalid) value into the h:inputText.
> 2) User clicked button.
> 3) Submitted values (if present) of all components in the form are 
> saved (custom code).
> 4) Redirect to other page.
> 5) User makes selection on another page.
> 6) Redirect back to form page.
> 7) Submitted values restored to the form (custom code).
> 8) View renders.
>
> I'm not sure in 8 whether the submitted value will be used or the 
> actual value (which is probably still null).  The JSF spec doesn't 
> make it clear whether the submitted value takes precedence for
rendering if it is set.
>
> Any help or suggestions appreciated.
>
> Cheers.
>
> Mike.
>   This e-mail is bound by the terms and conditions described at 
> http://www.subexazure.com/mail-disclaimer.html
>
>
>


 This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html


Re: Saving component submitted values

Posted by Mike Kienenberger <mk...@gmail.com>.
When rendering, the submitted value is used if non-null.
Then the local value is used if it is set on the component.
Then the backing bean model value is used.


On 4/2/07, Mike Quilleash <mi...@subexazure.com> wrote:
>
>
> Hi all,
>
> My question put simply is: Does the value of submittedValue on a
> UIInput/EditableValueHolder take precedence over the an actual value when it
> comes to rendering the component?
>
>
> Background:
>
> I've been trying to find a way to save component values between redirects.
> I have a form with 2 input controls, one is a h:inputText the other a custom
> component.  The custom component is a disabled input text paired with a
> custom immediate command button.  The button takes the user to another view
> where they can search and select an entity, click ok and get redirected back
> to form page with the disabled input text filled in.  This is all ok and
> works correctly.
>
> The problem I have is other components' values in the form (like the
> h:inputText in the example) will not be saved by default as I am not doing a
> postback (and may not be valid yet).  So I'm wondering if the following may
> work.
>
> 1) User enters (possibly invalid) value into the h:inputText.
> 2) User clicked button.
> 3) Submitted values (if present) of all components in the form are saved
> (custom code).
> 4) Redirect to other page.
> 5) User makes selection on another page.
> 6) Redirect back to form page.
> 7) Submitted values restored to the form (custom code).
> 8) View renders.
>
> I'm not sure in 8 whether the submitted value will be used or the actual
> value (which is probably still null).  The JSF spec doesn't make it clear
> whether the submitted value takes precedence for rendering if it is set.
>
> Any help or suggestions appreciated.
>
> Cheers.
>
> Mike.
>   This e-mail is bound by the terms and conditions described at
> http://www.subexazure.com/mail-disclaimer.html
>
>
>