Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MessageResource.properties - The Only Way?

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me kind of strange that with all the XML STRUTS uses, the MessageResource.properties file is so flat.
Is this the only way to handle this part of STRUTS? Granted that there isn't much to what this file does except specify text properties, but for a huge STRUTS App, wouldn't this file get really difficult to maintain?
Any comments? Opinions?
[ June 11, 2003: Message edited by: Gregg Bolinger ]
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg,
With a huge app you can break it down into modules -- each with their own properties file. I think you're right about the flatness of it though. I really don't like that fact that long text string have to occupy one line. XML tag delimiters would sure be nice!
Darryl
 
Josh Landin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default message factory used by struts is a Property file parser (digester) that simply creates resource bundles from prop files. As a standard java props file, long lines can be broken onto multiple lines using "\". Also, if you want your bundle to be XML, simply subclass the org.apache.struts.util.MessageResourcesFactory and write your own digester. Creating your own bundle factory can be vary handy in a lot of situations like when you want to do resource string replacements.
For Example:
system.name=Longhorn
system.version=1.0
system.fullname={system.name} {system.version}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic