Re: Custom Component Binding problem
Sir My class is inherited from UIInput, but the problem is that, when i call setSubmittedValue in decode method, it does not work( in the sense that the bean value is not updated ). Waiting for ur reply. Regards Martin Marinschek <[EMAIL PROTECTED]> wrote: If you subclass from UIInput, the rest is done implicitly in theprocessValidators and the processUpdates Method.regards,MartinOn 12/5/05, wasim bhatti <[EMAIL PROTECTED]>wrote:> Hey martin,>> Of the three states that you have mentioned ... which one do i have to do> explicity ?> because i am calling the>> set as a submitted value (done in decoding phase)>> explicitly but i think the value is not bein g set. i have no validators for> my component. should that cause some problem ? the rest of the 2 phases are> invoked implicitly ?>> what do u mean when u say local values ?>> how do i check whether the value is being set when i call setSubmittedvalue.> all i know is that i place a call to setSubmittedvalue but the setter in> the bean is never callled.>> Thanx a lot.>> Martin Marinschek <[EMAIL PROTECTED]>wrote:> 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 deco de, 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 wrote:> > Greetings,> >> > I have made a custom component using myfaces 1.0.9. Everythi ng 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 shou ld 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 i n 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> > Yahoo! Shopping> Find Great Deals on Gifts at Yahoo! Shopping>>--http://www.irian.atYour JSF powerhouse -JSF Consulting, Development andCourses in English and GermanProfessional Support for Apache MyFaces Yahoo! Shopping Find Great Deals on Gifts at Yahoo! Shopping
Re: Custom Component Binding problem
If you subclass from UIInput, the rest is done implicitly in the processValidators and the processUpdates Method. regards, Martin On 12/5/05, wasim bhatti <[EMAIL PROTECTED]> wrote: > Hey martin, > > Of the three states that you have mentioned ... which one do i have to do > explicity ? > because i am calling the > > set as a submitted value (done in decoding phase) > > explicitly but i think the value is not being set. i have no validators for > my component. should that cause some problem ? the rest of the 2 phases are > invoked implicitly ? > > what do u mean when u say local values ? > > how do i check whether the value is being set when i call setSubmittedvalue. > all i know is that i place a call to setSubmittedvalue but the setter in > the bean is never callled. > > Thanx a lot. > > Martin Marinschek <[EMAIL PROTECTED]> wrote: > 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 wrote: > > Greetings, > > > > I have made a custom component using myfaces 1.0.9. Everythi ng 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 > > > > > > Yahoo! Shopping > Find Great Deals on Gifts at Yahoo! Shopping > > -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: Custom Component Binding problem
Hey martin, Of the three states that you have mentioned ... which one do i have to do explicity ? because i am calling the set as a submitted value (done in decoding phase) explicitly but i think the value is not being set. i have no validators for my component. should that cause some problem ? the rest of the 2 phases are invoked implicitly ? what do u mean when u say local values ? how do i check whether the value is being set when i call setSubmittedvalue. all i know is that i place a call to setSubmittedvalue but the setter in the bean is never callled. Thanx a lot.Martin Marinschek <[EMAIL PROTECTED]> wrote: 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 beenprocessed, this is when setValid() is called, you don't have to do ityourself)- 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 isconvertable and valid, else the local value will never be set.if the local value is set - and all other components on the page havevalid values, the value is written through to the backing bean in theupdate model phase.somewhat clearer?regards,MartinOn 12/5/05, wasim bhatti <[EMAIL PROTECTED]>wrote:> Greetings,>> I have made a custom component using myfaces 1.0.9. Everythi ng 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.atYour JSF powerhouse -JSF Consulting, Development andCourses in English and GermanProfessional Support for Apache MyFaces Yahoo! Shopping Find Great Deals on Gifts at Yahoo! Shopping
Re: Custom Component Binding problem
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
Custom Component Binding problem
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