aspose file tools*
The moose likes Struts and the fly likes MessageResource.properties - The Only Way? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "MessageResource.properties - The Only Way?" Watch "MessageResource.properties - The Only Way?" New topic
Author

MessageResource.properties - The Only Way?

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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 ]

GenRocket - Experts at Building Test Data
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
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

Joined: Jun 09, 2003
Posts: 10
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}
 
jQuery in Action, 2nd edition
 
subject: MessageResource.properties - The Only Way?