Rechercher : dans
Par :

Struts 1 formulaire dynamique

Dernière réponse le 3 jun 2008 à 21:33:41 mmanas, le 7 mai 2008 à 16:59:13 
 Signaler ce message aux modérateurs

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://jakarta.apache.org/struts/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>

Configuration: Windows 2000, struts 1, Tomcat6, eclipse
Firefox 1.0

1

 struts, le 3 jun 2008 à 21:33:41

Comment s'appelle votre formulaire ? et comment lançer vous votre application
D'autre part les noms des parametres ne me semblent pas conformes (xxxx.yyyy.jsp) il y a un point qui traine

Répondre à struts