Cannot find global ActionForward for name initAction
	
	
		bonjour,
je travaille avec spring, struts et hibernate , et lors de l'execution j'ai eu cet erreur.
 
voici ma classe java où on doit initialiser les parametres du fichier web.xml :
	Code:
	
| 12
 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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 
 | package com.school.commons.controlleur;
 
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
 
 
import com.school.domain.commons.IServiceDomain;
 
import com.school.domain.admistration.ManipUtilisateur;
 
 
 
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionServlet;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
 
 
public class MainServlet extends ActionServlet {
 
	private ActionErrors errors = new ActionErrors();
	private ActionError error;
 
	private IServiceDomain serviceDomain = null;
	private ManipUtilisateur manipUtilisateur = null;
 
	private ServletConfig config;
	private final String SPRING_CONFIG_FILENAME = "springConfigFileName";
	private final String[] parameters = {SPRING_CONFIG_FILENAME};
 
	public IServiceDomain getServiceDomain()
	{
		serviceDomain = (IServiceDomain)(new XmlBeanFactory(
				new ClassPathResource((String)config.getInitParameter((SPRING_CONFIG_FILENAME)))))
				.getBean("serviceDomain");
		return serviceDomain;
	}
	public void setServiceDomain(IServiceDomain serviceDomain)
	{
		this.serviceDomain = serviceDomain;
	}
 
	public ManipUtilisateur getManipUtilisateur()
	{
		if(manipUtilisateur==null)
		{
			manipUtilisateur = (ManipUtilisateur)(new XmlBeanFactory(
				new ClassPathResource((String)config.getInitParameter((SPRING_CONFIG_FILENAME)))))
				.getBean("manipUtilisateur");
		}
		return manipUtilisateur;
	}
	public ManipUtilisateur getManipUtilisateurForTest()
	{
		if(manipUtilisateur==null)
		{
			manipUtilisateur = (ManipUtilisateur)(new XmlBeanFactory(
				new ClassPathResource("Spring-config.xml")))
				.getBean("manipUtilisateur");
		}
		return manipUtilisateur;
	}
	public void setManipUtilisateur(ManipUtilisateur manipUtilisateur)
	{
		this.manipUtilisateur = manipUtilisateur;
	}
 
	public ActionErrors getErrors()
	{
		return errors;
	}
	public void setErrors(ActionErrors errors)
	{
		this.errors = errors;
	}
 
	public void setMainServletForManips(MainServlet mainServlet)
	{
		ManipUtilisateur.setMainServlet(this);
		/*ManipDemande.setMainServlet(this);
		ManipDotation.setMainServlet(this);
		ManipEntite.setMainServlet(this);
		ManipEntreeAchat.setMainServlet(this);
		ManipEntreeExcep.setMainServlet(this);
		ManipFamille.setMainServlet(this);
		ManipFournisseur.setMainServlet(this);
		ManipLot.setMainServlet(this);
		ManipProduit.setMainServlet(this);
		ManipSortieExcep.setMainServlet(this);
		ManipSourceAchat.setMainServlet(this);	*/
	}
 
 
	/*public void init() throws ServletException{
		//init classe parent
		System.out.print("Action servlet initialisée");
		super.init();
		//on récupère les parametres d'initialisation de la servlet
		config = getServletConfig();
		String param = null;
		for(int i=0;i<parameters.length;i++)
		{
			param = config.getInitParameter(parameters[i]);
			if(param == null)
			{
				//on mémorise l'erreur
				error = new ActionError("error.init.failure",parameters[i]);
				errors.add("init", error);
			}
		}
		//en cas d'erreurs 
		if(errors.size()!=0)
			return;
 
		//on initialise l'attribut mainServlet pour toutes 
		//les classes 'Manip' pour pouvoir les instancier
		setMainServletForManips(this);
 
		return;
	}*/
 
 
} | 
 ma classe InitAction :
	Code:
	
| 12
 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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 
 | package com.school.commons;
 
import java.util.List;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionServlet;
 
import com.school.commons.controlleur.MainServlet;
import com.school.domain.admistration.ManipUtilisateur;
 
 
 
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
 
public class InitAction extends Action  {
 
 
 
 
	public ActionForward execute(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) {
 
 
 
			InitForm initForm = (InitForm)form;
 
			MainServlet mainServlet = (MainServlet) this.getServlet();
 
			ActionErrors errors = mainServlet.getErrors();
			if(errors.size()!=0)
			{
				saveErrors(request,errors);
				return mapping.findForward("afficherErreursPage");
			}
 
			List utilisateurs = ManipUtilisateur.getInstance().getUtilisateurList();
 
			initForm.setListUtilisateur(utilisateurs);
 
			return mapping.findForward("afficherLoginPage");
		}
 
 
 
 
} | 
 et mon fichier Web.xml :
	Code:
	
| 12
 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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 
 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app> 
   <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>com.school.commons.controlleur.MainServlet</servlet-class>
      <init-param>
         <param-name>config</param-name>
         <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param>
      <init-param>
			<param-name>springConfigFileName</param-name>
			<param-value>spring-config.xml</param-value>
	  </init-param>
      <init-param>
         <param-name>debug</param-name>
         <param-value>3</param-value>
      </init-param>
      <init-param>
         <param-name>detail</param-name>
         <param-value>3</param-value>
      </init-param>
      <load-on-startup>0</load-on-startup>
   </servlet>
<!--   <servlet>-->
<!--   	<servlet-name>Connexions</servlet-name>-->
<!--   	<servlet-class>menu.Connexions</servlet-class> -->
<!--   </servlet>-->
   <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
   </servlet-mapping>
 <!--   <servlet-mapping>
   	<servlet-name>Connexions</servlet-name>
   	<url-pattern>/Connexions</url-pattern>
   </servlet-mapping> -->
   <welcome-file-list>
     <welcome-file>vues/Init.jsp</welcome-file>
   </welcome-file-list>
</web-app> | 
 mon fichier Spring-config.xml :
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 
 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
 
<beans>
	<!-- la classe d'accès aux données -->
	<bean id="serviceDao" class="com.school.dao.commons.ServiceDao">
	</bean>
 
	<!-- les classes métier -->
	<bean id="serviceDomain"  class="com.school.domain.commons.ServiceDomain">
		<property name="serviceDao">
			<ref bean="serviceDao"/>
		</property>
	</bean>
 
   <bean id="manipUtilisateur" class="com.school.domain.admistration.ManipUtilisateur">
		<property name="serviceDomain">
			<ref bean="serviceDomain"/>
		</property>
	</bean>	
 
</beans> | 
 merci d'avance :)
	 
	
	
	
		je vous donne mon Struts config
	
	
		
	Code:
	
| 12
 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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 
 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
   <data-sources />
 
   <form-beans >
      <form-bean name="initForm" type="com.school.commons.InitForm"/>
 
   </form-beans>
 
   <global-exceptions>
   	<exception 
         	key="error.database.failureSelect" 
         	path="/vues/erreurs/Erreurs.jsp"
         	scope="request"
         	type="com.school.exception.UncheckedAccessException"/>
   </global-exceptions>
 
   <global-forwards>
   	<forward name="initAction" 
      	 	path="/initAction.do" redirect="true" > 
      	 	</forward>
   </global-forwards>
 
   <action-mappings >
   	  <action 
      	 attribute="initForm"
      	 scope="session"
      	 path="/initAction"
      	 name="initForm"
      	 type="com.school.commons.InitAction"
      	 validate="false">
      	 <forward name="afficherErreursPage" 
      	 	path="/vues/erreurs/Erreurs.jsp" />
      	 <forward name="afficherLoginPage" 
      	 	path="/vues/Login.jsp" />
      </action>
      <action
         attribute="initForm"
         name="initForm"
         path="/authentificationAction"
         validate="false"
         type="com.school.commons.AuthentificationAction">
         <exception 
         	key="error.database.failureSelect" 
         	path="/vues/Login.jsp"
         	scope="request"
         	type="com.school.commons.exception.UncheckedAccessException"/>
         <forward name="afficherLoginPage" 
      	 	path="/vues/Login.jsp" />
         <forward name="afficherPageAdministrateur" 
         	path="/vues/MainAdmin.jsp" />
         <forward name="afficherPageProfesseur" 
         	path="/vues/MainProf.jsp" />
         <forward name="afficherPageTuteur" 
         	path="/vues/MainTuteur.jsp" />
      </action>
   </action-mappings>
 
   <message-resources parameter="ApplicationResources" />
 
   </struts-config> | 
 
	 
	
	
	
		je vous donne aussi la jsp Init.jsp
	
	
		
	Code:
	
| 12
 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
 
 |  
 
<%@ page language="java"%>
 
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
 
    <title>Init.jsp</title>
 
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
  </head>
 
  <body>
  <logic:forward name="initAction"/>
  </body>
</html:html> |