• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Struts + I18N

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic