CelinHC
CelinHC

Reputation: 1984

InputText binded to a null double filed present "0.0"

Is there a way to prevent this without creating a new converter?

<p:inputText value="#{myMB.myDouble}" />

@ManagedBean
@SessionScoped
public class MyMB
    private Double myDouble = null;
....

When i enter to the view i want to see the empty input field, not with "0.0".

Upvotes: 3

Views: 1127

Answers (1)

BalusC
BalusC

Reputation: 1108912

That can happen if you're using Tomcat 6.0.16 or newer or a fork of it using the same Apache EL parser, like JBoss AS and WebSphere AS. You basically need to tell the Apache EL parser to not coerce the primitives to their defaults by the following VM argument which is supported since Tomcat 6.0.17:

-Dorg.apache.el.parser.COERCE_TO_ZERO=false

This problem is not related to JSF. It doesn't occur on Glassfish, for example.

Upvotes: 4

Related Questions