4

On my page, I have <pe:inputNumber> which refers to a not mandatory field. If I leave it empty, it sets the value to 0 even if I set emptyValue = "". What should I do or what should I use, if this component cannot offer me that functionality?

Tiny
28k113 gold badges352 silver badges611 bronze badges
asked Jan 30, 2013 at 15:22
3
  • 1
    try using Integer/Long instead of int/long Commented Jan 30, 2013 at 15:35
  • I already use Integer not int and yet the same problem Commented Jan 30, 2013 at 15:42
  • Try setting <pe:inputNumber emptyValue="empty" , and post your code Commented Jan 30, 2013 at 16:01

1 Answer 1

6

You might need to specifically instruct JSF to interpret empty input fields as null as against coercing it to "0" with the context-param

<context-param>
 <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
 <param-value>true</param-value>
</context-param>

Additionally, for a container built on tomcat (JBoss, WSphere etc), you should set the following JVM config property (pretty easy to do within an IDE)

-Dorg.apache.el.parser.COERCE_TO_ZERO=false
answered Jan 30, 2013 at 17:02
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.