that needs quite a long explanation, I'll try to give you a short one ;)
there are three states your component values can be in:
- set as a submitted value (done in decoding phase)
- set as a local value (done after conversion and validation has been
processed, this is when setValid() is called, you don't have to do it
yourself)
- set in the backing bean (done in the update model phase)
so in decode, you need to set the submitted value.
for conversion and validation, you have to make sure that the value is
convertable and valid, else the local value will never be set.
if the local value is set - and all other components on the page have
valid values, the value is written through to the backing bean in the
update model phase.
somewhat clearer?
regards,
Martin
On 12/5/05, wasim bhatti <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> I have made a custom component using myfaces 1.0.9. Everything worked fine
> to start with, and i was able to bind values of the component to the back
> end managed bean. At least there was no problem in retrieving values from
> the bean. The trouble occurs when the vlaue changes from the front.
> According to the binding principles the value should be set at the back end
> bean. but the setter is never called.
>
> Should the value setting take place in the decode method ?
> My decode method is as follows :
>
> public void decode( FacesContext context )
> {
> Map requestMap =
> context.getExternalContext().getRequestParameterMap();
> String clientId = getClientId( context );
> try
> {
> String dateFrom = requestMap.get( clientId + DATE_FROM
> ).toString() ;
> setSubmittedValue( dateFrom );
> setValid( true );
> }
> catch( NumberFormatException ex )
> {
> ex.printStackTrace();
> setSubmittedValue( (String)requestMap.get(clientId + DATE_FROM)
> );
> }
> }
>
> What is the specific function of the setSubmittedVal ue ? as in if i have
> more than 1 inputs in my encode method which ones value would be set when
> decode is called ?
> I can get the new values from the front using getSubmittedValue but the
> value is never propagated to the bean.
>
> Any help would be much appreciated.
>
> regards,
> a newbie to jsf
>
>
>
> ________________________________
> Yahoo! DSL Something to write home about. Just $16.99/mo. or less
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces