• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which data type is better?

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I declared ALL field as a String in action form,If we need integer field,i Use only String instead of int,reason is while we declared integer in action form,in jsp side the field associated particular field(text field in jsp) display zero defualt, and further we need steps to clear the text field in design side.

My question is my friend said dont use String variable it takes more memory rather than int ,please suggest me String or Integer?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right to use only Strings in your ActionForm. Struts specifically recommends it.

Your friend is right that it uses more memory, but so what? We're talking about one or two bytes difference, and in these days of cheap memory, that is not significant.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep...Struts 1.x likes Strings. I do use types like long or int to represent index values of lists and for some id values that are passed along as hidden fields. I use Strings for all editable fields.

- Brent
reply
    Bookmark Topic Watch Topic
  • New Topic