wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 12

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: 296

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: http://aspose.com/file-tools
subject: Handling int default to zero
Similar Threads
field value displayed wrongly
default value=0 of int field changing in form struts
Data Transfer Object
retrieve action field in jsp
NumberFormatException in spring