Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 8, 2009 6:47 AM
Hi,
First, I tried to search for this but, I can't figure out how to limit the search to this forum only. Would you know how?
Here's my question:
We are migrating from JSF 1.1 to 1.2. The InputText tag use to return Null for an empty Integer value but returns a zero in JSF 1.2.
In our code we always check only for Null. Is there a work around that would not involve changing all or validation?
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 8, 2009 6:56 AM
(reply 1
of 13) (In reply to
original post )
Hi
i have a similar problem. I am using JSF 1.2_08
I created a <h:selectOneMenu> with several selectItems. The IDs are the database IDs which can be 0.
If nothing is selected i need a null-value returned but for some reason i get a 0.
I tried to create a custom converter where i convert the empty string (this is the html-value of the empty option) to "null" but somewhere after that it gets converted to zero. I also tried to use "-" instead of the empty string, same result.
Can anyone point me to a workaround solution? Is this a bug or intended behaviour?
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 8, 2009 8:15 AM
(reply 2
of 13) (In reply to
original post )
Correct
Since JSF 1.2, the unified EL implementation as provided by the application server will be used to evaluate EL expressions. So this issue is in fact also application server dependent. For instance all Tomcat versions up to 6.0.14 would work as expected, but since some bugfix which was released since Tomcat 6.0.16 this unwanted side effect occurred.
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 8, 2009 9:27 AM
(reply 4
of 13) (In reply to
#2 )
thanks a lot, this solved my problem!
btw: i had the problem with tomcat 6.0.16 where the VM argument
-Dorg.apache.el.parser.COERCE_TO_ZERO=false
has no effect.
i upgraded to 6.0.18, it works in this version (since 6.0.17 i believe).
i do run into other problems though, for example the following expression language term does not work anymore:
<rich:toolTip rendered="#{!empty(texts['test2'])}" value="#{texts['test2']}"/>
this is used to show tooltips only when they are not null. i will look into this some more tomorrow.
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 8, 2009 9:43 AM
(reply 5
of 13) (In reply to
#4 )
styx2000 wrote:
btw: i had the problem with tomcat 6.0.16 where the VM argument
-Dorg.apache.el.parser.COERCE_TO_ZERO=false
has no effect.
i upgraded to 6.0.18, it works in this version (since 6.0.17 i believe).
does anybody know why this is? everytime i make an upgrade of some part of the framework i run into problems like that, they cost me a lot of time.
i looked at the EL specification, there are no parentheses in the example there, but parentheses should be at least allowed in this spot shouldnt they?
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 9, 2009 3:58 AM
(reply 7
of 13) (In reply to
#6 )
I´ve never used parentheses for this kind of constructions. If the EL spec also doesn´t state anything about it, I wouldn´t mark it as a bug. You may want to report it at the Tomcat mailinglist/issuetracker to see what they have to say about it.
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 9, 2009 4:06 AM
(reply 8
of 13) (In reply to
#7 )
i didnt think it was, it is just annoying to me that i have to change my code so often.
im sure it's my own fault in a way because i write code that isn't 100% correct (because i dont know better), but i would appreciate it if code that works keeps working after an update.
this happened to me twice already while im working on the current project and we had to do the upgrades because we wanted to use some new features.
this project is kind of a prototype in our department, as we havent used this technology yet. if we have a lot of troubles we will go back to previous technologies and im wondering if i was just especially unlucky or if this is an issue that will arise a lot. i like the java platform a lot, but so far we are a lot slower than before (we use oracle forms a lot, which is hard to compare to a j2ee web application, but still).
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 9, 2009 4:30 AM
(reply 10
of 13) (In reply to
#9 )
i understand, i just wish that i get an error when i write incorrect code. then this wouldnt have happened either (assuming this really is wrong syntax, just because there are no parentheses in the example in the spec doesnt mean theyre illegal).
Re: Migr. to JSF 1.2 - InputText of Integer value returns 0 instead of Null
Jan 9, 2009 10:58 AM
(reply 11
of 13) (In reply to
#2 )
BalusC, do you know of any settings (Tomcat or JVM) that could affect a For Loop behavior?
I have code that contains an outer and inner loop. The exact same code (cut & paste) works fine under Tomcat 5.5.15/JSF 1.1 and Java 1.5.0.11 but,
not under Tomcat 6.0.18/JSF 1.2 and Java 1.6.0_01.
When the inner loop Breaks, the outer loop value doesn't increase. I've turned this upside down, I'm 99% sure I'm not missing anything. I even re-copied the code from one environment to the other. Still have the problem. Any ideas what I could do next?
for (int i = 0; i < dataRowListSize; i++) {
for (int j = 0; j < supportList.size(); j++) {
...
break;
}
} // end of the top loop