Avoid the default value of 0 to display in h: inputText

I have <h:inputText>one that takes a value longsimilar to this

<h:inputText value="#{ServiceTable.ID}" />

A property is declared as follows

public class ServiceTable {

    private long ID;

    // Getter and setter for ID.
}

When I open the page, I always see 0in the text box. How can i avoid this? I just need an empty text box. I am using JSF 1.2.

+5
source share
2 answers

Use Longinstead Long. It is equal by default null.

private Long ID;

And if you are using Tomcat 6.0.16 or later or its plug, you need to add the following VM argument to the server startup arguments, as well as disable forced EL enforcement of primitives and their wrappers:

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

! , : " ".

?

, , - String bean.

+1

All Articles