• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic