I am working on a jsp/servlet web application. I currently use a switch statement within my servlet to select the appropriate error message for each form field (according to the input) and then set that message as a request attribute.
I now want to internationalize the web page (have it available in another language). I was thinking to do this by having a separate directory for the other language and placing the jsps in the other language in that directory. Then a filter will redirect to the appropriate directory via a session attribute.
The problem is that my custom error messages are currently written in the servlet. I was not planning to reroute to different servlets according to the language (ie: same servlet will run for all languages). The only way that I can think of to do this would be to write each of the custom error messages on the jsp and then have the servlet set a request attribute that identifies the error type.
This solution would require adding a lot of text to the jsps (some fields have 10 different error messages and different messages depending on user type).
Any suggestions of a better approach for making the form error messages multi lingual are welcome. Also, if there are any general suggestions on a better way to internationalize my site altogether that is also welcome.
Thank you, .