[program-java] Re: Property files

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <program-java@xxxxxxxxxxxxx>, <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 9 Jul 2009 11:16:21 -0400

This is not a good approach, I would say.  While it saves you time, it feels
like a hack.  If you want to change the way all your error messages are
displayed, you have to now edit a bunch of resource bundles.  You're
replicating code across the French, German, English, and so on, properties
files, and you're not allowing for flexible css extensibility later on.

Instead, I'd write extensible wrappers which you can use as drop-ins, in
your java code.  This would most likely be coded in a combination of jsp for
the output and formatting, and java for the backend retrieval.

Take care,
Sina

________________________________

From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, July 09, 2009 10:07 AM
To: program-l@xxxxxxxxxxxxx; program-java@xxxxxxxxxxxxx
Subject: [program-java] Property files



Hello: 

Sorry for the cross post but this might be of some interest. 

I have a resource file strings_en.properties that contain my English error
messages?. I also have a French version with you guessed it?. French error
messages.

I use locale specific information that is digested by the resource bundle in
order to display the correct version of an error message. I'm assuming that
most modern programming languages have a similar mechanism.

My question deals with embedding html code into my string. Since I would
like to use the property file in a web application I would like to do as
much server side processing as possible. So I was wondering if the following
would work:

Key.key_message = <p>Hello World</p> 

Obviously if the html tags are there in the first place, I wouldn't have to
create as many error forms, in reality I was hoping to limit the number of
forms to one or two generic and then pop in the appropriate error message.
Any thoughts?

Jim 

James M. Corbett 

Programmer / Analyst 
GST/HST Micros | Micros de la TPS/TVH 
Business Suite Assessing Systems (BSAS) 
Revenue and Accounting Systems Directorate (RASD) | Direction des Systèmes
de revenu et de comptabilité (DSRC) 
Information Technology Branch (ITB) | Direction générale de l'informatique
(DGI) 
Canada Revenue Agency | Agence du revenue du Canada 

(613) 941-1338 

"...Is a hippopotamus a hippopotamus, or just a really cool Opotamus?" 



Other related posts: