wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts + I18N Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts + I18N" Watch "Struts + I18N" New topic
Author

Struts + I18N

Borja Beltran
Greenhorn

Joined: Jan 03, 2011
Posts: 1
Hi,

I have a Struts application of a library and i have one problem with the i18n.
All the site is also in spanish and english. To change the language i use the typical flags in the footer of the page.

I want the user can change the language in every page but I don't want to be redirected to the home page, so I'm storing in the session the actionforward in every action to know where the user is. Also, i add to the session the resources stored in the request so the jsp can use it As an example, think in a list of books, the action stores in the request an attribute with the list of books and redirects to the jsp, then the jsp obtains and shows the list. If the user changes the language, the ChangeActionLanguage needs to assign this resource in the request, so the list can be used when returning to the jsp.



When the user clicks one flag, an action to change the language is called. It obtains the actionforward of the session (stored by the last action executed) and redirects the user



Ok, this works fine almost in every page.

The problem is when using an ActionForm to update the book. In this case, the jsp obtains the data directly from the actionform, so when the user is watching the data of the book to be modified, if changes the language, the form can't be populated again, and shows empty.

How can i solve this? I can store the URL of every action instead storing the actionforward, but then the action is called twice, and if you use tokens to avoid that an action is called twice it will not work...
Anyway, are there other ways that i can use to change the language of my site remaining in the same page? Which is the best way?

I'm using Struts 1.3.10.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts + I18N