The moose likes Struts and the fly likes Handling int default to zero Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Handling int default to zero" Watch "Handling int default to zero" New topic

Handling int default to zero

Jon Greenwood

Joined: Mar 13, 2011
Posts: 15

I have a struts 1.3 application.

I have a new <html:text> field in a .jsp that maps to a formsbean.
The formsbean has its getters and setters correctly working.

The variable is of type int and it is defaulting to 0 in the .jsp.

What is the best way of ?nulling? this field in the .jsp?

Thanks in advance
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 297

Hi Jon,

Is there any special purpose you want to make the field null..

Struts sets the default value based on datatype ,so if int is there then it sets to 0
.. Please correct me if i am wrong.

I agree. Here's the link:
subject: Handling int default to zero
It's not a secret anymore!