salut,
j'ai fais un formulaire avec un combobox,j'ai essaye de suivre le tutorial de sierge tahe.
mais lorsque j'apple un .do il m'affiche l'erreur suivante:
La ressource demandée (Servlet action n'est pas disponible.) n'est pas disponible.
voila mon struts-config:
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 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
| "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean
name="frmPersonne" type="istia.st.struts.controle.FormulaireBean"/>
<form-bean
name="frmReclamation" type="istia.st.struts.reclamation.controle.ReclamationForm">
<form-property name="serv_demandeur" type="java.lang.String"/>
<form-property name="combo" type="java.lang.String"/>
<form-property name="etat" type="java.lang.String"/>
<form-property name="date_e" type="java.lang.String"/>
<form-property name="date_a" type="java.lang.String"/>
<form-property name="date_p" type="java.lang.String"/>
<form-property name="description" type="java.lang.String"/>
<form-property name="degre_u" type="java.lang.String"/>
<form-property name="date_p" type="java.lang.String"/>
<form-property name="valeursCombo" type="java.lang.String[]" />
</form-bean>
</form-beans>
<action-mappings>
<action
path="/mainrec"
name="frmReclamation"
scope="session"
validate="true"
input="/erreursRec.do"
parameter="/vues/mainrec.jsp"
type="istia.st.struts.reclamation.controle.ReclamationAction">
<forward name="afficherFormulaire" path="/vues/formulaire.reclamation.jsp"/>
<forward name="reponseRec" path="/vues/reponse.reclamation.jsp"/>
</action>
<action
path="/formulaireRec"
parameter="/vues/formulaire.reclamation.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/erreursRec"
parameter="/vues/erreurs.reclamation.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/reponseRec"
parameter="/vues/reponse.reclamation.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
</action-mappings>
<message-resources parameter="ressources.personneressources"/>
<!-- <message-resources parameter="ressources.reclamationressources"/>-->
</struts-config> |
mon web.xml
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
| <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>authentification</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<!--le controleur Struts avait besoin d'un certain nombre d'informations
qui se trouvent dans le fichier de configuration struts-config.xml-->
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<!-- cette balise indique que le controleur sera atteint via toutes les URL se terminant par le suffixe .do
declarees dans le fichier de conf -->
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app> |
mon action
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 33 34 35 36 37 38 39 40 41 42 43
| package istia.st.struts.reclamation.controle;
import istia.st.struts.geststock.modele.AccesBDGestStock;
import istia.st.struts.modele.AccesBD;
import istia.st.struts.reclamation.modele.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
public class ReclamationAction extends Action{
public AccesBDBT abt=new AccesBDBT();
public ArrayList vect ;
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException,ServletException {
ReclamationForm formulaire=(ReclamationForm)form;
formulaire.set("valeursCombo", getValeurs(5, "combo"));
// on rend la main
return mapping.findForward("afficherFormulaire");
}
}
private String[] getValeurs(int taille, String label) {
String[] valeurs = new String[taille];
for (int i = 0; i < taille; i++) {
valeurs[i] = label + i;
}
return valeurs;
}
} |
et ma jsp:
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 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
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><meta http-equiv="pragma" content="no-cache">
<head><title>reclamation</title>
<script language="javascript">
function effacer(){
with(document.frmReclamation){
serv_demandeur.value="";
demandeur.value="";
num_machine.value="";
etat.value="";
date_a.value="";
degre_u.value="";
date_p.value="";
description.value="";
}
}
</script>
</head><body>
<html:form action="/mainrec" >
<label>service demandeur :
<html:select property="serv_demandeur" size="1" style="width:150px">
<html:option value ="" > </html:option>
<html:option value = "1"> developpement</html:option>
<html:option value = "2"> conception</html:option>
<html:option value = "3"> installation</html:option>
<html:option value = "4"> hardware-système</html:option>
<html:option value = "5"> communication</html:option>
</html:select>
<br />demandeur :
<html:text property="demandeur" size="1" style="width:150px"/></label><p>
<label>désignation équipemet :
<html:select name="frmReclamation" property="combo">
<html:options name="frmReclamation" property="valeurscombo"/>
</html:select>
</label></p><p><label>état :
<html:select property="etat" style="width:150px">
<html:option value = ""></html:option>
<html:option value = "1">arrét total</html:option>
<html:option value = "2">mal fonctionnement</html:option>
</html:select>
</label></p><p><label>date d'envoi :
<html:text property="date_e" /></label></p><p>
<label>degré d'urgence :
<html:select property= "degre_u">
<html:option value = ""></html:option>
<html:option value = "1">urgent</html:option>
<html:option value = "2">normal</html:option>
</html:select></label></p><p>
<label>date planifiée :
<html:text property="date_p" /></label></p><p>
<label>date d'arret :
<html:text property="date_a" /></label></p><p>
<label>description
<html:textarea property="description"></html:textarea>
<p> </p><p align="center">
<html:submit property="btnenvoyer" value="envoyer" /></label>
<html:button property="btneffacer" value="effacer" onclick="effacer()"/>
<html:submit property="btnquitter" value="quitter" /></p></html:form></body>
</html> |
je m'excuse si c'est long mais quelqu'un pour m'aider a resoudre mon pb.
merci d'avance
Partager