[jira] Commented: (MYFACES-2161) MyFaces-API issue: getValue of UIInput

2009-03-10 Thread Leonardo Uribe (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-2161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12680685#action_12680685
 ] 

Leonardo Uribe commented on MYFACES-2161:
-


 This problem suppose that UIInput component uses a converter that convert 
empty strings to null values. It seems that the solution done in 1.1.x branch 
were not applied on 1.2.x. Maybe it was because default converter for 
HtmlInputText does not convert empty strings to null values.

The solution committed is put this code on UIInput:

public Object getValue()
{
if (isLocalValueSet()) return super.getLocalValue();
return super.getValue();
}

I have committed a test that reproduce this scenario too.

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-2161
 URL: https://issues.apache.org/jira/browse/MYFACES-2161
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-252
Affects Versions: 1.2.6
Reporter: Kaeri Johnson
 Fix For: 1.2.7-SNAPSHOT


 Issue was seen and fixed in Myfaces 1.1.6 already- but seems to still exist 
 in 1.2.6 
 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (MYFACES-2161) MyFaces-API issue: getValue of UIInput

2009-03-10 Thread Leonardo Uribe (JIRA)

 [ 
https://issues.apache.org/jira/browse/MYFACES-2161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonardo Uribe resolved MYFACES-2161.
-

   Resolution: Fixed
Fix Version/s: 1.2.7-SNAPSHOT
 Assignee: Leonardo Uribe

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-2161
 URL: https://issues.apache.org/jira/browse/MYFACES-2161
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-252
Affects Versions: 1.2.6
Reporter: Kaeri Johnson
Assignee: Leonardo Uribe
 Fix For: 1.2.7-SNAPSHOT


 Issue was seen and fixed in Myfaces 1.1.6 already- but seems to still exist 
 in 1.2.6 
 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (MYFACES-2161) MyFaces-API issue: getValue of UIInput

2009-03-06 Thread Kaeri Johnson (JIRA)
MyFaces-API issue: getValue of UIInput
--

 Key: MYFACES-2161
 URL: https://issues.apache.org/jira/browse/MYFACES-2161
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-252
Affects Versions: 1.2.6
Reporter: Kaeri Johnson


Issue was seen and fixed in Myfaces 1.1.6 already- but seems to still exist in 
1.2.6 

UIOutput currently has the following code:

 public Object getValue()
 {
 if (_value != null) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }

UIInput has the following code:

 public void setValue(Object value)
 {
 setLocalValueSet(true);
 super.setValue(value);
 }

My problem (pseudo code):

1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again

proposed solution:

UIInput overwrites getValue of UIOutput:

 public Object getValue()
 {
 if (isLocalValueSet()) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: MyFaces-API issue: getValue of UIInput

2007-03-03 Thread Martin Marinschek

I forwarded the thread to Ed, as neither Adam, Craig, Kito or Manfred
had anything to say on this... or do they?

There is an alternative workaround: I checked it in RendererUtils
yesterday - for you to review. However, I think it makes the value
lookup code in the renderer very complicated. It might cause less
issues with compatibility to the RI behaviour, though.

regards,

Martin

On 3/2/07, Cagatay Civici [EMAIL PROTECTED] wrote:

 Yeah, exactly. Did you read my mail from before? Plus my new
issue-evaluation?

No, I read your mail after sending a reply about the converter, anyway
you're right about the bug Martin.

 In this case, I'd strongly recommend that you run this by the spec
 folks.   If nothing else, we should get a clarification for the next
 revision.

I agree with Mike

 On 3/2/07, Mike Kienenberger [EMAIL PROTECTED] wrote:
 In this case, I'd strongly recommend that you run this by the spec
 folks.   If nothing else, we should get a clarification for the next
 revision.

 On 3/1/07, Martin Marinschek  [EMAIL PROTECTED] wrote:
  I didn't find anything in the spec.
 
  JavaDoc of getValue in UIOutput says:
 
  Gets the value of this UIComponent. First, consult the local value
  property of this component. If non-null return it. If non-null, see if
  we have a ValueBinding for the value  property. If so, return the
  result of evaluating the property, otherwise return null.
 
  This description is obviously wrong (two times If non-null..), but
  if you correct this obvious  mistake, it speaks against my solution.
 
  But then, reading the spec on a more general level it says:
 
  3.1.4 Value Binding Expressions
 
  Properties and attributes of standard concrete component classes may be
value
  binding enabled. This means that, rather than specifying a literal value
as the
  parameter to a property or attribute setter, the caller instead
associates a
  ValueBinding (see Section 5.3.3 ValueBinding) whose getValue() method
must
  be called (by the property getter) to return the actual property value
  to be returned
  if no value has been set via the corresponding property setter. If a
property or
  attribute value has been set, that value must be returned by the
property getter
  (shadowing any associated value binding expression for this property).
 
  and this would clearly indicate I'm on the right track. Properly
  reading this would mean we are wrong-doers for every component
  attribute of every component, even if the chance is rather small that
  the issue arises for normal attributes (it might definitely happen
  though).
 
  regards,
 
  Martin
 
  On 3/1/07, Mike Kienenberger  [EMAIL PROTECTED] wrote:
   What's the spec say about UIInput's getValue()?   If it's silent, I'd
   say your solution makes sense.
  
  
   On 3/1/07, Martin Marinschek  [EMAIL PROTECTED] wrote:
Wanted to discuss a small thing with you:
   
UIOutput currently has the following code:
   
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ?
(Object)vb.getValue(getFacesContext()) : null;
  }
   
UIInput has the following code:
   
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
   
My problem (pseudo code):
   
1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again
   
proposed solution:
   
UIInput overwrites getValue of UIOutput:
   
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ?
(Object)vb.getValue(getFacesContext()) : null;
  }
   
everyone d'accord?
   
regards,
   
Martin
   
--
   
http://www.irian.at
   
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
   
Professional Support for Apache MyFaces
   
  
 
 
  --
 
  http://www.irian.at
 
  Your JSF powerhouse -
  JSF Consulting, Development and
  Courses in English and German
 
  Professional Support for Apache MyFaces
 






--

http://www.irian.at

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

Professional Support for Apache MyFaces


[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-02 Thread Martin Marinschek (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477314
 ] 

Martin Marinschek commented on MYFACES-1549:


Direct access to UIOutput getLocalValue:

http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513319r1=513318r2=513319

regards,

Martin

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-02 Thread Martin Marinschek (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477317
 ] 

Martin Marinschek commented on MYFACES-1549:


Reduced state-array size again, and tried the fix from the other side as well: 
the code in RendererUtils has the same problem.

http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513799r1=513798r2=513799

regards,

Martin

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: MyFaces-API issue: getValue of UIInput

2007-03-02 Thread Cagatay Civici


Yeah, exactly. Did you read my mail from before? Plus my new
issue-evaluation?



No, I read your mail after sending a reply about the converter, anyway
you're right about the bug Martin.

In this case, I'd strongly recommend that you run this by the spec

folks.   If nothing else, we should get a clarification for the next
revision.



I agree with Mike

On 3/2/07, Mike Kienenberger [EMAIL PROTECTED] wrote:


In this case, I'd strongly recommend that you run this by the spec
folks.   If nothing else, we should get a clarification for the next
revision.

On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:
 I didn't find anything in the spec.

 JavaDoc of getValue in UIOutput says:

 Gets the value of this UIComponent. First, consult the local value
 property of this component. If non-null return it. If non-null, see if
 we have a ValueBinding for the value  property. If so, return the
 result of evaluating the property, otherwise return null.

 This description is obviously wrong (two times If non-null..), but
 if you correct this obvious  mistake, it speaks against my solution.

 But then, reading the spec on a more general level it says:

 3.1.4 Value Binding Expressions

 Properties and attributes of standard concrete component classes may be
value
 binding enabled. This means that, rather than specifying a literal value
as the
 parameter to a property or attribute setter, the caller instead
associates a
 ValueBinding (see Section 5.3.3 ValueBinding) whose getValue() method
must
 be called (by the property getter) to return the actual property value
 to be returned
 if no value has been set via the corresponding property setter. If a
property or
 attribute value has been set, that value must be returned by the
property getter
 (shadowing any associated value binding expression for this property).

 and this would clearly indicate I'm on the right track. Properly
 reading this would mean we are wrong-doers for every component
 attribute of every component, even if the chance is rather small that
 the issue arises for normal attributes (it might definitely happen
 though).

 regards,

 Martin

 On 3/1/07, Mike Kienenberger [EMAIL PROTECTED] wrote:
  What's the spec say about UIInput's getValue()?   If it's silent, I'd
  say your solution makes sense.
 
 
  On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:
   Wanted to discuss a small thing with you:
  
   UIOutput currently has the following code:
  
 public Object getValue()
 {
 if (_value != null) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext())
: null;
 }
  
   UIInput has the following code:
  
 public void setValue(Object value)
 {
 setLocalValueSet(true);
 super.setValue(value);
 }
  
   My problem (pseudo code):
  
   1) user enters an empty string in an input-component: 
   2) conversion and validation phase:  -- setValue(null);
   isLocalValueSet = true; setSubmittedValue(null);
   3) validation fails in some component on the page -- update model
   phase is skipped
   4) renderer calls getValue(); -- getValue() evaluates the
   value-binding, as the local-value is 'null', and I get the
   default-value of the bean shown again
  
   proposed solution:
  
   UIInput overwrites getValue of UIOutput:
  
 public Object getValue()
 {
 if (isLocalValueSet()) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext())
: null;
 }
  
   everyone d'accord?
  
   regards,
  
   Martin
  
   --
  
   http://www.irian.at
  
   Your JSF powerhouse -
   JSF Consulting, Development and
   Courses in English and German
  
   Professional Support for Apache MyFaces
  
 


 --

 http://www.irian.at

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

 Professional Support for Apache MyFaces




MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek

Wanted to discuss a small thing with you:

UIOutput currently has the following code:

 public Object getValue()
 {
 if (_value != null) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }

UIInput has the following code:

 public void setValue(Object value)
 {
 setLocalValueSet(true);
 super.setValue(value);
 }

My problem (pseudo code):

1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again

proposed solution:

UIInput overwrites getValue of UIOutput:

 public Object getValue()
 {
 if (isLocalValueSet()) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }

everyone d'accord?

regards,

Martin

--

http://www.irian.at

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

Professional Support for Apache MyFaces


Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Cagatay Civici

Hi Martin,

I just tried the scenario but couldn't reproduce it.

Shouldn't the second step be;
2) conversion and validation phase:  -- setValue(); isLocalValueSet =
true; setSubmittedValue(null);

An empty string instead of null is set by setValue(), so the local value
becomes , preventing the old value be displayed again.

Cagatay,

On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:


Wanted to discuss a small thing with you:

UIOutput currently has the following code:

  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) :
null;
  }

UIInput has the following code:

  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }

My problem (pseudo code):

1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again

proposed solution:

UIInput overwrites getValue of UIOutput:

  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) :
null;
  }

everyone d'accord?

regards,

Martin

--

http://www.irian.at

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

Professional Support for Apache MyFaces



Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek

that entirely depends on the converter! If the converter sets a 'null'
as the local-value (which is the only choice if the date-type is not a
string), we are having a problem.

regards,

Martin

On 3/1/07, Cagatay Civici [EMAIL PROTECTED] wrote:

Hi Martin,

I just tried the scenario but couldn't reproduce it.

Shouldn't the second step be;
2) conversion and validation phase:  -- setValue(); isLocalValueSet =
true; setSubmittedValue(null);

An empty string instead of null is set by setValue(), so the local value
becomes , preventing the old value be displayed again.

Cagatay,


On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:
 Wanted to discuss a small thing with you:

 UIOutput currently has the following code:

   public Object getValue()
   {
   if (_value != null) return _value;
   ValueBinding vb = getValueBinding(value);
   return vb != null ?
(Object)vb.getValue(getFacesContext()) : null;
   }

 UIInput has the following code:

   public void setValue(Object value)
   {
   setLocalValueSet(true);
   super.setValue(value);
   }

 My problem (pseudo code):

 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again

 proposed solution:

 UIInput overwrites getValue of UIOutput:

   public Object getValue()
   {
   if (isLocalValueSet()) return _value;
   ValueBinding vb = getValueBinding(value);
   return vb != null ?
(Object)vb.getValue(getFacesContext()) : null;
   }

 everyone d'accord?

 regards,

 Martin

 --

 http://www.irian.at

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

 Professional Support for Apache MyFaces






--

http://www.irian.at

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

Professional Support for Apache MyFaces


[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476879
 ] 

Martin Marinschek commented on MYFACES-1549:


I added the value in UIInput to the restoreState/saveState-process - see:

http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513253r1=513252r2=513253

regards,

Martin

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476878
 ] 

Martin Marinschek commented on MYFACES-1549:


I had to change a bit more, cause the value field is private and I couldn't 
access it from the UIInput.

Link to commit log:

http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513252r1=513251r2=513252

regards,

Martin

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Resolved: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek (JIRA)

 [ 
https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Marinschek resolved MYFACES-1549.


Resolution: Fixed

 MyFaces-API issue: getValue of UIInput
 --

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


 UIOutput currently has the following code:
  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }
 UIInput has the following code:
  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }
 My problem (pseudo code):
 1) user enters an empty string in an input-component: 
 2) conversion and validation phase:  -- setValue(null);
 isLocalValueSet = true; setSubmittedValue(null);
 3) validation fails in some component on the page -- update model
 phase is skipped
 4) renderer calls getValue(); -- getValue() evaluates the
 value-binding, as the local-value is 'null', and I get the
 default-value of the bean shown again
 proposed solution:
 UIInput overwrites getValue of UIOutput:
  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (MYFACES-1549) MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek (JIRA)
MyFaces-API issue: getValue of UIInput
--

 Key: MYFACES-1549
 URL: https://issues.apache.org/jira/browse/MYFACES-1549
 Project: MyFaces Core
  Issue Type: Bug
  Components: JSR-127
Affects Versions: 1.1.5
Reporter: Martin Marinschek
 Assigned To: Martin Marinschek
 Fix For:  1.1.6-SNAPSHOT


UIOutput currently has the following code:

 public Object getValue()
 {
 if (_value != null) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }

UIInput has the following code:

 public void setValue(Object value)
 {
 setLocalValueSet(true);
 super.setValue(value);
 }

My problem (pseudo code):

1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again

proposed solution:

UIInput overwrites getValue of UIOutput:

 public Object getValue()
 {
 if (isLocalValueSet()) return _value;
 ValueBinding vb = getValueBinding(value);
 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Cagatay Civici

I think using a converter can cause this issue, here's the code from UIInput

public void validate(FacesContext context)
   {
   if (context == null) throw new NullPointerException(context);
   Object submittedValue = getSubmittedValue();
   if (submittedValue == null) return;

   Object convertedValue = getConvertedValue(context, submittedValue);

   if (!isValid()) return;

   validateValue(context, convertedValue);

   if (!isValid()) return;

   Object previousValue = getValue();
   setValue(convertedValue);
   setSubmittedValue(null);
   if (compareValues(previousValue, convertedValue))
   {
   queueEvent(new ValueChangeEvent(this, previousValue,
convertedValue));
   }
   }

So when the converter returns null value, setValue(null) occurs and old
value will be displayed in the page as you said. You don't have a converter
like this right Martin?


Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Martin Marinschek

Yeah, exactly. Did you read my mail from before? Plus my new issue-evaluation?

regards,

Martin

On 3/1/07, Cagatay Civici [EMAIL PROTECTED] wrote:

I think using a converter can cause this issue, here's the code from UIInput

 public void validate(FacesContext context)
{
if (context == null) throw new
NullPointerException(context);
Object submittedValue = getSubmittedValue();
if (submittedValue == null) return;

Object convertedValue = getConvertedValue(context, submittedValue);

if (!isValid()) return;

validateValue(context, convertedValue);

if (!isValid()) return;

Object previousValue = getValue();
setValue(convertedValue);
setSubmittedValue(null);
 if (compareValues(previousValue, convertedValue))
{
queueEvent(new ValueChangeEvent(this, previousValue,
convertedValue));
}
}

So when the converter returns null value, setValue(null) occurs and old
value will be displayed in the page as you said. You don't have a converter
like this right Martin?




--

http://www.irian.at

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

Professional Support for Apache MyFaces


Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Mike Kienenberger

What's the spec say about UIInput's getValue()?   If it's silent, I'd
say your solution makes sense.


On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:

Wanted to discuss a small thing with you:

UIOutput currently has the following code:

  public Object getValue()
  {
  if (_value != null) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

UIInput has the following code:

  public void setValue(Object value)
  {
  setLocalValueSet(true);
  super.setValue(value);
  }

My problem (pseudo code):

1) user enters an empty string in an input-component: 
2) conversion and validation phase:  -- setValue(null);
isLocalValueSet = true; setSubmittedValue(null);
3) validation fails in some component on the page -- update model
phase is skipped
4) renderer calls getValue(); -- getValue() evaluates the
value-binding, as the local-value is 'null', and I get the
default-value of the bean shown again

proposed solution:

UIInput overwrites getValue of UIOutput:

  public Object getValue()
  {
  if (isLocalValueSet()) return _value;
  ValueBinding vb = getValueBinding(value);
  return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
  }

everyone d'accord?

regards,

Martin

--

http://www.irian.at

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

Professional Support for Apache MyFaces



Re: MyFaces-API issue: getValue of UIInput

2007-03-01 Thread Mike Kienenberger

In this case, I'd strongly recommend that you run this by the spec
folks.   If nothing else, we should get a clarification for the next
revision.

On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:

I didn't find anything in the spec.

JavaDoc of getValue in UIOutput says:

Gets the value of this UIComponent. First, consult the local value
property of this component. If non-null return it. If non-null, see if
we have a ValueBinding for the value  property. If so, return the
result of evaluating the property, otherwise return null.

This description is obviously wrong (two times If non-null..), but
if you correct this obvious  mistake, it speaks against my solution.

But then, reading the spec on a more general level it says:

3.1.4 Value Binding Expressions

Properties and attributes of standard concrete component classes may be value
binding enabled. This means that, rather than specifying a literal value as the
parameter to a property or attribute setter, the caller instead associates a
ValueBinding (see Section 5.3.3 ValueBinding) whose getValue() method must
be called (by the property getter) to return the actual property value
to be returned
if no value has been set via the corresponding property setter. If a property or
attribute value has been set, that value must be returned by the property getter
(shadowing any associated value binding expression for this property).

and this would clearly indicate I'm on the right track. Properly
reading this would mean we are wrong-doers for every component
attribute of every component, even if the chance is rather small that
the issue arises for normal attributes (it might definitely happen
though).

regards,

Martin

On 3/1/07, Mike Kienenberger [EMAIL PROTECTED] wrote:
 What's the spec say about UIInput's getValue()?   If it's silent, I'd
 say your solution makes sense.


 On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote:
  Wanted to discuss a small thing with you:
 
  UIOutput currently has the following code:
 
public Object getValue()
{
if (_value != null) return _value;
ValueBinding vb = getValueBinding(value);
return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
}
 
  UIInput has the following code:
 
public void setValue(Object value)
{
setLocalValueSet(true);
super.setValue(value);
}
 
  My problem (pseudo code):
 
  1) user enters an empty string in an input-component: 
  2) conversion and validation phase:  -- setValue(null);
  isLocalValueSet = true; setSubmittedValue(null);
  3) validation fails in some component on the page -- update model
  phase is skipped
  4) renderer calls getValue(); -- getValue() evaluates the
  value-binding, as the local-value is 'null', and I get the
  default-value of the bean shown again
 
  proposed solution:
 
  UIInput overwrites getValue of UIOutput:
 
public Object getValue()
{
if (isLocalValueSet()) return _value;
ValueBinding vb = getValueBinding(value);
return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
}
 
  everyone d'accord?
 
  regards,
 
  Martin
 
  --
 
  http://www.irian.at
 
  Your JSF powerhouse -
  JSF Consulting, Development and
  Courses in English and German
 
  Professional Support for Apache MyFaces
 



--

http://www.irian.at

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

Professional Support for Apache MyFaces