You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/05/02 22:58:41 UTC

DO NOT REPLY [Bug 44928] New: Submitting empty text in inputText results in Integer with value '0' being set in backing bean (ELSupport)

https://issues.apache.org/bugzilla/show_bug.cgi?id=44928

           Summary: Submitting empty text in inputText results in Integer
                    with value '0' being set in backing bean (ELSupport)
           Product: Tomcat 6
           Version: 6.0.16
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: errorken@yahoo.com


I'm using tomcat 6.0.16 in combination with JSF RI 1.2_04.

I created a very simple page in which I have a form, one inputText and one
commandButton. The inputText value binds to a backing bean with the property
'test' of type java.lang.Integer.

So, when I click the submit button the numeric value I have entered in the
inputText gets set on the backing bean; all going fine.

However, when I submit an empty value (I leave the inputText empty) I see that
an Integer with value '0' is being set on the backing bean. This (logically)
results in a '0' being shown in my inputText after submitting the form (since
the property value of the backing has changed to '0').

It seems that the coerseNumber method of class "org.apache.el.lang.ELSupport"
is returning "ZERO" (which is a new Long(0L)) when the object passed to the
method is NULL. This cannot be right? Why would this implementation decide to
return a value when the supplied value was null? The same goes for Boolean.
When a NULL Boolean is given, it will return Boolean.FALSE...

I tested the same application (with the same libraries) on glfassfish and I had
no problems there...

So I'm wondering what is going wrong here on tomcat.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44928] Submitting empty text in inputText results in Integer with value '0' being set in backing bean (ELSupport)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44928





--- Comment #2 from Errorken <er...@yahoo.com>  2008-05-03 03:16:51 PST ---
Yes, you are right, thanks.

But why are there differences between the sun EL RI and apache's one?
Further more, why on earth is the spec saying that null should be converted to
0? Thats sounds like fuzy logic behavior to me.

Also, if I add a validator to the inputText, like:

<h:inputText value="#{testBean.integer}" required="false">
    <f:validateLongRange minimum="5" maximum="10"/>
</h:inputText>

Now it gets even more wrong. The first time I enter no value => submit
succeeds. In my backing bean I'm receiving '0' which is normally not possible
since the validator is forcing a value from 5 till 10.

Then, when the page is re-rendered, a '0' appears in the text field since the
value on the backing bean has become '0'. If I then re-submit again, I get a
validation error "Validation Error: Specified attribute is not between the
expected values of 5 and 10".

So, besides the fact this is setting values on my backing bean which are
normally not allowed, imagine that I have a search page in wich I have like 5
numerical fields which are not required but must have a value greater then 0.
The user will have to manually blank these fields out after each submit then?
(if he leaves these fields empty in the first submit)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44928] Submitting empty text in inputText results in Integer with value '0' being set in backing bean (ELSupport)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44928


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-05-02 14:47:25 PST ---
Please take a look at https://issues.apache.org/bugzilla/show_bug.cgi?id=43285,
specifically comment 7. I am guessing that this is what you are seeing. If not,
please re-open this bug and attach a test case that demonstrates the problem.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org