Struts 1 formulaire dynamique
mmanas
-
struts -
struts -
Bonjour,
je suis debutant, et je travail sur un tutoriel de Struts, de Mr Serge Tahé, je suis bloqué sur un exemple
il s'agit d'un simple formulaire pour saisir un nom et l'age, avec 3 bouttons, qu'il faut valider,
à mon niveau je n'arrive pas à afficher ce formulaire.voici le code du formulaire et ça bloc sur cette table:
<table><tr> <td>Nom</td>
<td><html:text property="nom" size="20"/></td>
</tr>
<tr><td>Age</td>
<td><html:text property="age" size="3"/></td>
</tr>
</table>
sinon le code du formulaire et le suivant:
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<meta http-equiv="pragma"content="no-cache">
<head>
<title>Personne- formulaire</title>
<script language="javascript">
function effacer(){
with(document.frmPersonne){
nom.value="";
age.value="";
}
}
</script>
</head>
<body>
<center>
<h2>Personne- formulaire</h2>
<hr>
<html:form action="/main" name="frmPersonne" type="service.PersonneDynaForm">
<table><tr> <td>Nom</td>
<td><html:text property="nom" size="20"/></td>
</tr>
<tr><td>Age</td>
<td><html:text property="age" size="3"/></td>
</tr>
</table>
<table><tr><td><html:submit value="Envoyer"/></td>
<td><html:reset value="Retablir"/></td>
<td><html:button property="btnEffacer" value="Effacer" onclick="effacer()"/></td></tr>
</table>
</html:form>
</center>
</body>
</html>
le struts-config est:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://struts.apache.org/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="frmPersonne" type="service.PersonneDynaForm">
<form-property name="nom" type="java.lang.String" initial=""/>
<form-property name="age" type="java.lang.String" initial=""/>
</form-bean>
</form-beans>
<action-mappings>
<action
path="/main"
name="frmPersonne"
scope="session"
validate="true"
input="/erreurs.do"
type="service.FormulaireAction"
>
<forward name="reponse" path="/reponse.do"/>
</action>
<action
path="/erreurs"
parameter="/vue/erreurs.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/reponse"
parameter="/vue/reponse.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/formulaire"
parameter="/vue/formulaire.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
</action-mappings>
<message-resources parameter="autre.MessageResources" />
</struts-config>
je suis debutant, et je travail sur un tutoriel de Struts, de Mr Serge Tahé, je suis bloqué sur un exemple
il s'agit d'un simple formulaire pour saisir un nom et l'age, avec 3 bouttons, qu'il faut valider,
à mon niveau je n'arrive pas à afficher ce formulaire.voici le code du formulaire et ça bloc sur cette table:
<table><tr> <td>Nom</td>
<td><html:text property="nom" size="20"/></td>
</tr>
<tr><td>Age</td>
<td><html:text property="age" size="3"/></td>
</tr>
</table>
sinon le code du formulaire et le suivant:
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<meta http-equiv="pragma"content="no-cache">
<head>
<title>Personne- formulaire</title>
<script language="javascript">
function effacer(){
with(document.frmPersonne){
nom.value="";
age.value="";
}
}
</script>
</head>
<body>
<center>
<h2>Personne- formulaire</h2>
<hr>
<html:form action="/main" name="frmPersonne" type="service.PersonneDynaForm">
<table><tr> <td>Nom</td>
<td><html:text property="nom" size="20"/></td>
</tr>
<tr><td>Age</td>
<td><html:text property="age" size="3"/></td>
</tr>
</table>
<table><tr><td><html:submit value="Envoyer"/></td>
<td><html:reset value="Retablir"/></td>
<td><html:button property="btnEffacer" value="Effacer" onclick="effacer()"/></td></tr>
</table>
</html:form>
</center>
</body>
</html>
le struts-config est:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://struts.apache.org/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="frmPersonne" type="service.PersonneDynaForm">
<form-property name="nom" type="java.lang.String" initial=""/>
<form-property name="age" type="java.lang.String" initial=""/>
</form-bean>
</form-beans>
<action-mappings>
<action
path="/main"
name="frmPersonne"
scope="session"
validate="true"
input="/erreurs.do"
type="service.FormulaireAction"
>
<forward name="reponse" path="/reponse.do"/>
</action>
<action
path="/erreurs"
parameter="/vue/erreurs.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/reponse"
parameter="/vue/reponse.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/formulaire"
parameter="/vue/formulaire.personne.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
</action-mappings>
<message-resources parameter="autre.MessageResources" />
</struts-config>
A voir également:
- Struts 1 formulaire dynamique
- Whatsapp formulaire opposition - Guide
- Tableau croisé dynamique - Guide
- Formulaire de réclamation facebook compte désactivé - Guide
- Formulaire de reclamation instagram - Guide
- Exemple tableau croisé dynamique télécharger - Télécharger - Tableur