Bonjour,
je souhaite quand je click sur un lien Contact pour qu'il me redirige vers cette page et il m'affiche sur la barre d'adresse http://localhost:8080/labs/Contact soit http://localhost:8080/labs
il me redirige comme ca :
http://localhost:8080/labs/Contact.xhtml

j'ai cherché et j'ai trouvé une fonction remplace le problème je l'est pas compris et je sais pas comment l’intégré dans mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
private void applyForward() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        // Find where to redirect the user.
        String redirect = getTheFromOutCome();
 
        // Change the Navigation context.
        NavigationHandler myNav = facesContext.getApplication().getNavigationHandler();
        myNav.handleNavigation(facesContext, null, redirect);
 
        // Update the user
        UIViewRoot vr = facesContext.getViewRoot();
        if (vr != null) {
            String url = facesContext.getExternalContext().getRequestContextPath();
            url = url + "/" + vr.getViewId().replace(".xhtml", ".jsf");
            Object obj = facesContext.getExternalContext().getResponse();
            if (obj instanceof HttpServletResponse) {
                HttpServletResponse response = (HttpServletResponse) obj;
                try {
                    response.sendRedirect(response.encodeURL(url));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
est ce que quelqu'un peut me donné une solution et comment l'implémenté

Merci