Problem with two input fields in a custom textbox.

2005-12-07 Thread wasim bhatti
Greetings  i have developed a custom component with two input fields but it is not working properly. The problem isthat, in decode method when we use to call setSubmittedValue(), we can only pass one argument in it. Then it updates only one value in the manage bean. The question is how can i update two values in decode method.  is it a limitation of custom components that we can use only one input field in one custom component?Regards  Wasim Bhatti
	
		Yahoo! Shopping 
Find Great Deals on Holiday Gifts at Yahoo! Shopping 

Custom Component Binding problem

2005-12-05 Thread wasim bhatti
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

Re: Custom Component Binding problem

2005-12-05 Thread wasim bhatti
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 tosetSubmittedvalue 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

2005-12-05 Thread wasim bhatti
Sir  My class is inherited from UIInput, but the problem is that, when icall setSubmittedValue in decode method, it does not work(in the sense that the bean value is not updated).  Waiting for ur reply.  RegardsMartin 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