• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Where to handle non-string data types in Struts

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

It seems that handling non-string data types such as dates and wrapped primitives is akward in Struts. I guess it would be nice if I didn't have to convert all my non-string values to Strings when copying them in to a FormBean and convert them back again when going from the FormBean to the JavaBean. Is this a job for a custom tag, or is this functionality already built in to Struts somewhere? Thanks for listening!
-j
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using the BeanUtils.copyProperties() method. You may have to write your own converters depending on your data types.

See this article and this article for more information.
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic