My team is enhancing and maintaining a very large and in some places
very old (8 yrs.) (pre-.jsp, servlets etc.) web app. As you can
imagine, there is no coherent strategy for error handling and error
stack traces are frequently throw onto the screen for the user to see.
There is also no coherent strategy for defining text in the .jsp pages
and the pages that are generated by the older portions of the
application. Struts is out of the question as is Spring. We need to
find a way to:
1. Define and maintain specific error messages in a central location
that can be maintained in multiple languages.
2. Do the same for text messages that are displayed in .jsp pages.
I've looked into using ResourceBundles in properties files. Has anyone
out there successfully used ResourceBundles for error messages and
displayed text? The application will eventually have be upgraded to a
Spanish version so we need to get a handle on this ASAP.
All suggestions are greatly appreciated!
Manish Pandit - 12 Sep 2006 22:18 GMT
Hi,
I have used resourcebundles and they come in handy.
What app-server does your application run on? Java has pretty good
support for locales as well. I've mostly used them as a part of a
larger struts app, and used struts taglibs to display the messages
based on the user's locale. Given your constraints, you might be better
off creating your own custom tags, which can then use java localization
and i18n to render messages. Other choice you have is to write
scriptlets :)
-cheers,
Manish
> My team is enhancing and maintaining a very large and in some places
> very old (8 yrs.) (pre-.jsp, servlets etc.) web app. As you can
[quoted text clipped - 14 lines]
>
> All suggestions are greatly appreciated!
Soren Kuula - 12 Sep 2006 22:28 GMT
Hi,
> I've looked into using ResourceBundles in properties files. Has anyone
> out there successfully used ResourceBundles for error messages and
> displayed text? The application will eventually have be upgraded to a
> Spanish version so we need to get a handle on this ASAP.
I think ResourceBundles is THE standard solution for internationalizing
web apps (and other apps). It is probably the most comnonly used.
But do use a tag lib to abstract away the Java code. Do not use
scriptlets -- because it will make your pages an ugly mix of different
languages.
I use XML JSP syntax and the JSTL tag lib myself. The only thing I hate
about that style of coding is the forgiveness of the EL language -- I
want to be told when something I expected to be non null was not :)
Soren
Manish Pandit - 12 Sep 2006 23:49 GMT
Totally agree on the forgiveness of the EL - and it hits when you least
expect it, and more often than not it is the end user who ends up
catching it :)
-cheers,
Manish
wgblackmon@yahoo.com - 13 Sep 2006 15:41 GMT
Thanks everyone. We don't use custom tags here but I'd be willing to
give them a try in this instance. Has anyone seen an example of using
tags with ResourceBundles? Of course I'll look via Google but if anyone
has any opinions I'd appreciate it. We are using Tomcat as a servlet
engine.
Thanks,
Bill
> Totally agree on the forgiveness of the EL - and it hits when you least
> expect it, and more often than not it is the end user who ends up
> catching it :)
>
> -cheers,
> Manish
Manish Pandit - 13 Sep 2006 17:03 GMT
Hi Bill,
You can use struts reourcebundles. There are plenty of turorials
available regarding those. Here are a couple of links:
http://www.systemmobile.com/?p=200
http://www.laliluna.de/struts-message-resources-tutorial.html
-cheers,
Manish