Im using spring, hibernate, java, and jsp. My problem is that when the integer value is zero it displays 0 in my textbox. I want to display only empty string but Idk how to do it. Please help.
In my jsp:
<form:form method="POST" commandName="division">
...
...
<form:input path="number"/>
</form:form>
In my domain:
/**
* Get the number of the division.
* @return The number.
*/
@Column(name = "NUMBER")
public int getNumber() {
return number;
}
/**
* Set the number of the division.
* @param number The division number.
*/
public void setNumber(int number) {
this.number = number;
}
You will have to use
spring:bindfor that.Also, you will have to use JSTL. Import it with:
In order to get the value for
number:The result of the
spring:bindis returned in a variable calledstatus, in itsvaluefield. Check if it is 0 and print nothing, else print the number:For more information, take a look at the spring:bind documentation.