I’m try to internalize my application with the next code:
For the jsp I have this:
<table>
<tr class="trlleno">
<td>
<div id="Panel_cliente">
<s:select label="Selecciona un idioma" name="IdiomaID" id="IdiomaID"
headerValue="--Selecciona un idioma--" headerKey="-1"
list="#{'1':'Español','2':'English','3':'Deutch','4':'Português','5':'русский','6':'Français'}" value="2"/>
</div>
</td>
</tr>
<td class="trboton" colspan="2" align="center">
<input type="submit" name="submit" id="submit" value="CAMBIAR IDIOMA" class="divboton"/>
</td>
</tr>
</table>
</form>
In the action I have this:
public class CambiarIdiomaAction extends ActionSupport implements ServletRequestAware{
private HttpServletRequest servletRequest;
Map session;
@Override
public String execute() throws Exception {
session = ActionContext.getContext().getSession();
int idm=Integer.valueOf(servletRequest.getParameter("IdiomaID"));
System.out.println(idm);
//Trying with English
Locale locale=new Locale("en","EN");
return "SUCCESS";
}
@Override
public void setServletRequest(HttpServletRequest request) {
this.servletRequest = request;
}
public HttpServletRequest getServletRequest() {
return servletRequest;
}
}
When I see if there is a change with the language, I see nothing, no changes. Why?. Thanks so much
You have to set locale in session if you want to change locale.
If you put this code in an Action:
You will change the locale of your app to English.
In your code you are doing nothing, you only are setting a variable
localeput you don’t do anything with it.