Bonjour,

j'ai voudrais faire un BreadCrumb à partir d'une url. Ce que j'ai fait est loin d’être optimiser et claire. (C'est un peu du bricolage :s)
Pouvez m'aider à l'améliorer?

mon path peut etre du genre : /admin/blabla/list/12/edit.html
ou
/admin/blabla/list/edit/12.html
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
 
    private static String REGEX_NOMBRE       = "([0-9]+/)";
    private static String REGEX_VIEW         = "/view";
    private static String REGEX_DOUBLE_SLASH = "//";
 
 
         String path = request.getServletPath().replace(".html", "").toString();
 
            path = path.replaceAll(REGEX_NOMBRE, "");
            path = path.replace(REGEX_VIEW, "");
            path = path.replace(REGEX_DOUBLE_SLASH, "");
            path = path.substring(1);
            path = path.replaceAll("(/[0-9]+)", "");
 
            int from = path.indexOf('/');
            int to = path.indexOf('/', from);
            // String str;
            ArrayList<String> str = new ArrayList<String>();
            if (from == -1)
                str.add(path);
            else {
                str.add(path.substring(0, from));
                str.add(path.substring(from + 1, path.length()).replace("/", "."));
            }
Et je voudrais récuperer dans mon tableau "str"
le premier token1 : admin
puis le reste de l'url sans les nombres et html
token2 : blabla.list.edit


Merci de votre aide.