• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts + I18N  RSS feed

Borja Beltran
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!