https://issues.apache.org/bugzilla/show_bug.cgi?id=45040
Summary: null string from web is converted to 0 in JSF Product: Tomcat 6 Version: 6.0.16 Platform: All OS/Version: All Status: NEW Severity: critical Priority: P2 Component: Jasper AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] My Environment is JSF 1.2(sun RI)+facelet+tomcat 6.0.16. There is an integer field in my web form. I monitored the submitted form using the tcpmon. The value is indeed empty. Debugging confirmed that the submitted value is empty. However, when it is "update model" in JSF, the value becomes Integer(0) while I expect a null object. I traced the code down to AstValue.setValue() line 1132: resolver.setValue(ctx, t.base, t.property, // coerce to the expected type ELSupport.coerceToType(value, resolver.getType(ctx, t.base, t.property))); which calls java/org/apache/el/lang/ELSupport.java line 198: public final static Number coerceToNumber(final Object obj) { line 199: if (obj == null) { line 200: return ZERO; The ELSupport here converts a null object to zero object. This makes it impossible to differentiate "an empty field" from "a field with 0" from web in JSF model object. Maybe the setValue in AstValue should be changed to resolver.setValue(ctx, t.base, t.property, value==null?null: ELSupport.coerceToType(value, resolver.getType(ctx, t.base, t.property))); thanks -jason -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]