Here my solution (some stuff I found on the net and adapted for my
needs). I don't actually use the "display" stuff, couse I do it
otherway... so you can ignore it.
I hope it'll help
Cheers
Danny
*********************************
1) Action
public class ChangeLocaleAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm
form,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
ChangeLocaleForm claf = (ChangeLocaleForm)form;
String languageCode = claf.getLanguageCode();
String forwardTo = claf.getDisplay();
System.out.println("forward to:"+forwardTo);
System.out.println("setting language to "+languageCode);
request.getSession().setAttribute(Globals.LOCALE_KEY, new
Locale(languageCode));
return
mapping.findForward((String)request.getSession().getAttribute("lastAction"));
}
2) ACTION FORM
public class ChangeLocaleForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = 1L;
private String languageCode = null;
private String display = null;
public ChangeLocaleForm() {
languageCode = null;
}
public void setLanguageCode(String inLanguageCode) {
languageCode = inLanguageCode;
}
public String getLanguageCode() {
return languageCode;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
}
2) JSP
<form name="changeLocaleForm" method= "post" action= "../changeLocale.do"
style= "display:inline;">
<input type= "hidden" name= "languageCode">
<input type="hidden" name="display" value="<%=request.getRequestURL()%>" >
<table width= "100% " border= "0 " cellpadding= "0 "
cellspacing= "0 " > <tr><td align= "right">
<input type= "image" src= "images/EN.gif" hspace= "6" border= "0"
onClick= "changeLocaleForm.languageCode.value='en';">
<input type= "image" src= "images/DE.gif" hspace="6"
border= "0" onClick= "changeLocaleForm.languageCode.value='de';">
</td></tr> </table>
</form>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]