Bonjour tt le monde
j travail sur une application struts et j ai besoin de help
j ai configurer le fichier struts-config , et j ai créé la LoginForm et l' LoginAction , qu'on je lance l execution dans le serveur tomcat je reçoit cette erreur
"No action instance for path /login could be created"
dans la console : " Error creating form bean of class LoginForm" ,
voici mon loginForm :
import org.apache.struts.action.*;
public class LoginForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = 1L;
private String m_username = "root";
private String m_password = "azerty";
public String getUsername() {
System.out.println("On passe par UserBean.getUsername !");
return this.m_username;
}
public void setUsername(String username) {
System.out.println("On passe par UserBean.setUsername !");
this.m_username = username;
}
public String getPassword() {
System.out.println("On passe par UserBean.getPassword !");
return this.m_password;
}
public void setPassword(String password) {
System.out.println("On passe par UserBean.setPassword !");
this.m_password = password;
}
}
et voici le loginaction
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm _form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// On traite la requête cliente
String cible = new String("success");
String user=null;
String pass=null;
if ( _form != null ) {
// Utilisation de form pour obtenir les paramètres de la requête
LoginForm form = (LoginForm) _form;
user = form.getUsername();
pass = form.getPassword();
System.out.println("Struts in action " + user + " - "
+ pass);
}
// On redirige vers la vue adaptée
// Cible en cas d'échec
if (( user == "") || (pass == "")) {
cible = new String("echec");
}
/*else {
request.setAttribute("COURS", cours);
}*/
// Transmission à la vue appropriée
ActionForward forward = mapping.findForward(cible);
System.out.println("forward :" + forward);
return (forward);
}
}
et mon struts config est :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources>
</data-sources>
<form-beans>
<form-bean
name=
"loginForm"
type=
"LoginForm"
/>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action
path=
"/login"
name=
"loginForm"
type=
"LoginAction"
>
<forward
name=
"success"
path=
"/tableauDeBord.jsp"
/>
<forward
name=
"echec"
path=
"/Acquisition.jsp"
/>
</action>
</action-mappings>
<controller
processorClass=
"org.apache.struts.tiles.TilesRequestProcessor"
/>
<message-resources
parameter=
"MessageResources"
/>
<plug-in
className=
"org.apache.struts.tiles.TilesPlugin"
>
<set-property
property=
"definitions-config"
value=
"/WEB-INF/tiles-defs.xml"
/>
<set-property
property=
"moduleAware"
value=
"true"
/>
</plug-in>
<plug-in
className=
"org.apache.struts.validator.ValidatorPlugIn"
>
<set-property
property=
"pathnames"
value=
"/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"
/>
</plug-in></struts-config>
jespère que vous pourriez m'aider
merci d'avance