0

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, .

theyuv
  • 1,556
  • 4
  • 26
  • 55
  • I think on Stack Overflow there is more or less no unasked question. Maybe this helps: http://stackoverflow.com/a/4278571 – Obenland Aug 25 '15 at 18:58
  • Yes, this is one option for how to do internationalization. I was leaning more towards have a separate set of jsps altogether for the additional langauge. Me placing the error messages in this fashion would require quite a bit of text in the jsp. – theyuv Aug 26 '15 at 08:07

0 Answers0