Error-handling recommendations

W

wgblackmon

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!
 
M

Manish Pandit

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
 
S

Soren Kuula

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
 
M

Manish Pandit

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
 
W

wgblackmon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,091
Latest member
PeakCBDIngredients

Latest Threads

Top