spring - Change locale (language) but retain form data -


i'm using spring , thymeleaf present form on web-page. user can change language clicking button on page. send get request same page again, requested locale appended parameter, e.g. <a href="?locale=en_gb">british english</a>.

i have requirement if user changes languages after filling in of form fields, entered values should maintained.

i guess i'll have post form server, can repopulate form when re-renders page in new language. there standard spring/thymeleaf way this?

i think i've got working using cookielocaleresolver localeresolver bean. then, when user clicks on button, set cookie , post form.

<a onclick="document.cookie='mylocalecookie=en_gb'; $('#the-form').submit();>british english</a> 

i'd still interested know if there's better or more standard way of doing though.


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -