This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have to internationalize an existing Struts based application. We have chosen the approach of having locale specific JSPs in separate folders (as our GUI look and feel may change for each customer, otherwise we would have gone for resource bundle approach).
I have all JSPs translated to Japanese. So based on the user language selection, I have to forward to either say JP/someJSP.jsp or EN/someJSP.jsp.
I was wondering if there is any way where with little modification to struts-config.xml alone, this can be acheived.
Otherwise, I have to have something like this in in all my action classes ...
String lang = request.getParameter("Language"); mapping.findForward(lang+"_success");
As you know, Struts handling lf i18n is based on the idea of using a single JSP with multiple properties files for different languages. If you want to use a different model, it's not as easy to implement.
One possibility you might consider would be to extend some of the struts classes to handle i18n the way you want. For example, you could extend ActionForward to include a language attribute, and then extend ActionServlet and RequestProcessor to handle the language attribute the way you want.
The way you're doing it may seem a little kludgy, but it's really not a bad way to go.