Re: multi-language url rewiting. Is it possible?

Splash Forums PrettyFaces Users multi-language url rewiting. Is it possible? Re: multi-language url rewiting. Is it possible?



Thanks, the picture is getting clearer. I prefer to use the pretty:link and it work perfectly!

Now I’m stuck on a commandLink, the one I used to change the language by clicking on a flag icon: when I ckick the flag, the url does not change the first time. It willl change if I click once more the flag or I navigate away from the page. Maybe this is a small issue but even adding ?faces-redirect=true the problem persists. Is there something related to pretty-faces?

Here is the xhtml snippet:

<h:commandLink immediate="true"
<h:graphicImage library="images" name="flags/flag_eng.gif" />

Here is the action:

public String changeLocale(String lang) {
languageCode = lang;
FacesContext context = FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(new Locale(languageCode));
String path = context.getExternalContext().getRequestServletPath();

String rewrittenURL = context.getExternalContext()
return rewrittenURL;

So rewrittenURL is correct (/mtc/en/main/welcome?faces-redirect=true) but the url in the address bar does not change.

The commandLink is part of the template so it is on every pages, also on those pages where the url-rewriting is not necessary.