Bonjour,
Je début avec Struts en suivi le tutoriel ici : http://kmdkaci.developpez.com/tutori...-avec-struts2/ . Mon problème est que je suis à la toute première étape et ça ne marche pas.
J'ai mes deux fichiers
web.xml
struts.xml
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 <?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>GestionDeveloppeur</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
Et j'ai en plus un fichier index.jsp qui affiche une page blanche
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 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="false" /> <package name="com.developpez.actions" namespace="/" extends="struts-default"> <!-- Action de l'action de réference --> <default-action-ref name="saisir_Developpeur"/> <action name="saisir_Developpeur"> <result>/jsp/saisir_Developpeur.jsp</result> </action> </package> </struts>
Voici l'architecture de mon application
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> </body> </html>
--- WebContent
------->META-INF
------------>MANIFEST.MF
------->WEB-INF
------------>Classes
----------------->Struts.xml
------------>Lib (contient les librairies)
------------>Web.xml
------->Index.jsp
Quand je vais sur la page : http://localhost:8080/Struts/ il me met une erreur 404.
Par contre quand je modifie le fichier Web.xml de la sorte :
Cela m'affiche une page blanche (ma page index.jsp). Je pense donc que se sont les lignes concernant struts qui posent problème. J'ai regardé si la classe org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter était bien présente et c'est le cas. J'ai voulu joué un peu avec le fichier struts.xml mais ca ne change rien. Je ne sais pas quoi faire de plus. Tout me semble conforme a ce qui est dans le tutoriel.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <?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>GestionDeveloppeur</display-name> </web-app>
Je tourne avec Ubuntu, Eclipse et JBoss.
Pouvez vous m'aider SVP?
Merci d'avance.
Partager