Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid default value in spring <form:input path="var" /> for int variable

I'm using Spring 3.1.0 JARs for my application. I have mapped my bean class with view through command name, I have no problem with mapping it works clearly.

The issue is that I'm having an int variable in my bean class:

private int id;

When I map this variable with <'form:input path="id" />', it gives the default value 0 in the text box which I don't want there. How can I get rid of this?

like image 640
sree Avatar asked Dec 21 '22 09:12

sree


1 Answers

I assume you are referring to a form model with 'id' as the private attribute to the model. Have you tried using an Integer instead of an int. An Integer is the class version of the primitive type int and this may solve your problem.

like image 75
blackpanther Avatar answered Dec 24 '22 01:12

blackpanther