...
Another common use case is using a link to change locales. On the HelloWorld page, let's add links to change the user's locale and to display a message from the application resources.
Panel |
---|
Code Block | |||||||||
---|---|---|---|---|---|---|---|---|---|
| |||||||||
<body> <h2><s:property value="message"/></h2> <h3>Languages</h3> <ul> <li> <s:url var="url" action="Welcome"> <s:param name="request_locale">en</s:param> </s:url> <s:a href="%{url}">English</s:a> </li> <li> <s:url var="url" action="Welcome"> <s:param name="request_locale">es</s:param> </s:url> <s:a href="%{url}">Espanol</s:a> </li> </ul> </body> |
Note |
---|
The |
How the Code Works
"%{url}" will be evaluated to the url defined with the s:url tag. On the Welcome and HelloWorld pages, we use two different Struts tags to create links. We create
...