You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ted Spradley <te...@gmail.com> on 2019/05/23 16:55:45 UTC
Tomcat (TomEE)/9.0.12 (8.0.0-M1) JSF 2.3 - Empty Strings from form
inputs expected as NULL
What is the current way of coercing empty string input fields to NULL With 9.0.12? This issue seems to come up with each new major version of EL/JSF.
All of the previous work arounds are no longer producing null values. Surely I’m missing something obvious that has been published.
Web.xml
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
Dropping the javax.el-3.0.1-b11.jar in WEB-INF/lib seems to have no effect.
Faces-config.xml
<application>
<el-resolver>com.example.EmptyToNullStringELResolver</el-resolver>
</application>
Custom el resolver causes a null pointer exception
java.lang.NullPointerException
at org.apache.myfaces.shared.resource.ValueExpressionFilterInputStream.read(ValueExpressionFilterInputStream.java:130)
at java.io.InputStream.read(InputStream.java:179)
at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:385)
at org.omnifaces.util.Utils.stream(Utils.java:397)
at org.omnifaces.resourcehandler.UnmappedResourceHandler.handleResourceRequest(UnmappedResourceHandler.java:176)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:196)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at ...
Thank you,
Ted S.