Bonsoir,
Je ne sais pas pourquoi, mais j'ai un problème de liens...
Mon projet est découpé de la façon suivante :
Voici mon fichier web.xmlWebContent /-->pages/
--> index.jsp
--> include/-->menu.html
Voici mon fichier menu.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
25
26
27
28
29
30
31
32 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Projet</display-name> <welcome-file-list> <welcome-file>pages/index.jsp</welcome-file> </welcome-file-list> <!-- Chargement de Spring --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <!-- Fichier de config de Spring --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:application-context.xml</param-value> </context-param> <!-- JSF --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> </web-app>
Peu importe les chemins que je donne, ça ne va jamais.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4<ul> <li><a href="/pages/accueil.jsf">Accueil</a></li> </ul>
A la base mon projet s'ouvre sur la page d'accueil via l'url (dans le navigateur) : http://localhost:8080/Projet/
si je mets <a href="/pages/accueil.jsf"> je suis redirigé vers http://localhost:8080/pages/accueil.jsf
si je mets <a href="accueil.jsf"> ça va marcher une première fois, mais au second click, je tombe sur http://localhost:8080/Projet/pages/pages/accueil.jsf
si je mets <a href="accueil.jsf"> je suis redirigé vers http://localhost:8080/Projet/accueil.jsf
Finalement, si je mets <a href="/accueil.jsf"> je suis redirigé vers
http://localhost:8080/accueil.jsf
Je ne sais plus quoi faire !
Merci d'avance pour votre aide !
Partager