Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL doesn't work at all #3075

Closed
ren-zhijun-oracle opened this issue Oct 28, 2013 · 21 comments

Comments

@ren-zhijun-oracle
Copy link
Contributor

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL in web.xml doesn't work at all with Mojarra 2.2.1 and 2.2.4. I created a very basic test project and ran it on GlassFish 3.1.2.2 with Mojarra 2.1.10 (changed EE version in POM to 6) and it works fine, but using 2.2.1 or 2.2.4 on GlassFish 4.0 (EE version changed to 7) the setter for a text input field is called with an empty string instead of null.

Environment

GlassFish 4.0

Affected Versions

[2.2.4]

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
Reported by kithouna

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
Issue-Links:
is related to
JAVASERVERFACES_SPEC_PUBLIC-1203

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
Please send your reproducer to issues@javaserverfaces.java.net. Thanks!

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
From email to issues@javaserverfaces.java.net

https://java.net/jira/browse/JAVASERVERFACES-3071

Just leave the input field empty and press the submit button.

Using Mojarra 2.2.4 I get:

Information: Constructed testcases.emptystring.TestBean@1007b020
Information: Getting string: null
Information: Setting string from null to
Information: Saving string:
Information: Getting string:

It should read (and does with Mojarra 2.1.10 on GF 3.1.2.2, EE versions in POM changed to 6):

Information: Constructed testcases.emptystring.TestBean@1007b020
Information: Getting string: null
Information: Setting string from null to null
Information: Saving string: null
Information: Getting string: null


Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! Rundum glücklich mit freenetMail

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
File: emptystring.zip
Attached By: @manfredriem

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
It was determined this is an EL issue and the EL implementation has been fixed to fix this.

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
Marked as fixed on Thursday, November 14th 2013, 12:45:58 pm

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
adrianosch said:
Where can we find the updated EL impl artifact? I've been searching for it, but '3.0' is the latest version in maven central.

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
dbenegiamo said:
Hi, Mojarra version 2.2.5 still have this issue. Mandred, could you kindly point to the proper fix? What we have to update instead of Mojarra?

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
rekiem87 said:
Latest glassfish build (4.0.1) still have the issue, workaround finded in http://stackoverflow.com/questions/21880017/interpret-empty-string-submitted-values-as-null-not-working

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
codylerum said:
This is a Wildfly 8.1.0.Final issue as well. Does anyone know which EL3 version or UEL issues fixes this?

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
codylerum said:
This is fixed in EL org.glassfish:javax.el 3.0.1-b05 which is being pulled into wildfly 8.x

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
mauromol said:
We are in December and javax.el 3.0.1-b05 is not yet available on Maven Central.
Also, the "Won't Fix" on UEL-13 is not encouraging...

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
See http://repo1.maven.org/maven2/org/glassfish/javax.el/3.0.1-b05/ which has been available since 7 July 2014

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
mauromol said:
Hmm... thank you, I was looking at javax.el:javax.el-api, which does not have version 3.0.1-b05.
Anyway, if I understand it correctly, there's nothing I can do with such a library update in my web application unless I change Tomcat's own JAR (also Tomcat 8 seems to suffer from this problem). Am I correct?

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
Yes Tomcat would have to patch their EL

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
mauromol said:
But I doubt they will ever do, since the did the opposite fix:
https://issues.apache.org/bugzilla/show_bug.cgi?id=56522
because of the EL specification has this requirement: [EL_SPEC-18](https://java.net/jira/browse/EL_SPEC-18 "null String are converted to "" on the bound bean properties")
I'm wondering what was fixed in Glassfish implementation: did they go against the specification?

Meanwhile, I really need some kind of workaround for my JSF environment. JAVASERVERFACES_SPEC_PUBLIC-1203 mentions an ELResolver... should I add it to my faces.config.xml inside ? I'm already using a SpringBeanFacesELResolver, does this interfere in some way? (I don't know how {{ELResolver}}s are chained...).
Sorry for asking here, but I already spent a lot of time to try to find out a solution: a converter doesn't do the trick, org.apache.el.parser.COERCE_TO_ZERO=false system property, which is suggested in some StackOverflow questions and blogs, doesn't work in Tomcat 8... I don't know what to do rather than post-process all my beans after a successful submission

Of course, javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is already set to true in web.xml...

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
@manfredriem said:
You will have to raise the issue in the EL_SPEC mailing list.

Yes you can add another ELResolver, but the ordering is dependent on your faces-config.xml and the other JARs included.

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
mauromol said:
Just for the records, a new issue has been filed for Tomcat too, at least to give the chance to override this via a custom EL resolver.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57309

@ren-zhijun-oracle
Copy link
Contributor Author

@javaserverfaces Commented
This issue was imported from java.net JIRA JAVASERVERFACES-3071

@ren-zhijun-oracle
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant