IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Struts 1 Java Discussion :

[STRUTS]Problème de form


Sujet :

Struts 1 Java

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Juillet 2003
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2003
    Messages : 18
    Points : 17
    Points
    17
    Par défaut [STRUTS]Problème de form
    Bonjour à tous,
    voila j'ai télécharger le pdf de serge tahe et en essayan une page contenant un formulaire à poster j'ai l'erreur suivante qui apparait:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    org.apache.jasper.JasperException: /vues/formulaire.personne.jsp(19,0) L'attribut name est incorrect pour le tag form d'après la TLD indiquée
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:238)
    	org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:975)
    	org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:696)
    	org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
    	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
    	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
    	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
    	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    	org.apache.jasper.compiler.Validator.validate(Validator.java:1475)
    	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:214)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
    	org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
    	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
    	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
    	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
    	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     
    concerant la tld, j'ai récupéré le fichier  fournit dans  struts1-2.7 (struts-html.tld)
     
    merci pour votre aide.
    [ Modéré par SEMPERE Benjamin ]
    Ajout d'un tag dans le titre
    Modification du titre
    Ajout des balises code
    Les Règles du Forum

  2. #2
    Membre éprouvé

    Profil pro
    Inscrit en
    Juin 2004
    Messages
    882
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juin 2004
    Messages : 882
    Points : 948
    Points
    948
    Par défaut
    peux tu mettre le code de tes différents fichiers:
    - struts-config
    - form
    - action
    ...

    Merci

    Sun Certified Business Component Developer
    Sun Certified Java Programmer
    --
    The definitive toolbox for GWT applications: gwt-toolbox
    My blog about Java and JEE: Benjamin's Blog

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Juillet 2003
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2003
    Messages : 18
    Points : 17
    Points
    17
    Par défaut
    Salut,

    voila le code
    pour le strutsconfig.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <?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>
    <action-mappings>
    <action
    path="/main"
    parameter="/vues/main.html"
    type="org.apache.struts.actions.ForwardAction"
    />
     
     
    <action
    path="/erreurs"
    parameter="/vues/erreurs.personne.jsp"
    type="org.apache.struts.actions.ForwardAction"
    />
     
    <action
    path="/reponse"
    parameter="/vues/reponse.personne.jsp"
    type="org.apache.struts.actions.ForwardAction"
    />
     
     
    <action
    path="/formulaire"
     
    parameter="/vues/formulaire.personne.jsp"
    type="org.apache.struts.actions.ForwardAction"
    />
     
    <form-beans>
      <form-bean 
                name="frmPersonne"
                 type="istia.st.struts.personne.FormulaireBean" />
     
      ...
    </form-beans>
     
     
    </action-mappings>
    </struts-config>
    pour le formulaire:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <%@ 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="istia.st.struts.personne.FormulaireBean">
    <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>
    <tr>
    </table>
    <table>
    <tr>
    <td><html:submit value="Envoyer"/></td>
    <td><html:reset value="Rétablir"/></td>
    <td><html:button property="btnEffacer" value="Effacer" onclick="effacer()"/></td>
    </tr>
    </table>
    </html:form>
    </center>
    </body>
    </html>
    pour le bean
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
     
    package istia.st.struts.personne;
    import org.apache.struts.action.ActionForm;
    public class FormulaireBean extends ActionForm {
    // nom
    private String nom = null;
    public String getNom() {
    return nom;
    }
    public void setNom(String nom) {
    this.nom = nom;
    }
    // age
    private String age = null;
    public String getAge() {
    return age;
    }
    public void setAge(String age) {
    this.age = age;
    }
    }

  4. #4
    Expert éminent sénior


    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    7 856
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 7 856
    Points : 34 380
    Points
    34 380
    Par défaut
    Bonsoir,

    N'oublie pas que le cours concerne Struts 1.1

    la version de struts que tu utilises ne requiert plus de donner tant d'informations pour la balise <html:form> (seul action suffit).

    Par contre, la definition d'une action ressemble plus à ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <action path="/main"
       name="frmPersonne"
       type="org.apache.struts.actions.ForwardAction">
       <forward name="success" path="/vues/main.html" />
    </action>
    Bon courage.

    Eric

  5. #5
    Membre régulier Avatar de java_fun
    Inscrit en
    Novembre 2004
    Messages
    117
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 117
    Points : 102
    Points
    102
    Par défaut
    bonjour, :o

    j ai eu le même problème je pense il suffit juste de mentionner dans ton **form** le nom de la action sans l attibuts name="nom_du_bean" car tu utilise struts 1.2 et non 1.1 ok bon courage !! 8)

    cordialement
    Java fun is back

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Juillet 2003
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2003
    Messages : 18
    Points : 17
    Points
    17
    Par défaut [resolu]Ca marche[/resolu]
    Bonjour,
    merci c'est réglé
    j'ai finalement opté pour le 1.1 pour ce tutorial
    comme je suis débuante

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 6
    Dernier message: 21/05/2007, 16h31
  2. Réponses: 12
    Dernier message: 01/07/2004, 11h03
  3. Réponses: 4
    Dernier message: 19/04/2004, 13h41
  4. [STRUTS] Problème avec des ActionForm
    Par zarbydigital dans le forum Struts 1
    Réponses: 2
    Dernier message: 29/03/2004, 13h49
  5. [Struts] Problème de formulaire(s) ...
    Par djoukit dans le forum Struts 1
    Réponses: 8
    Dernier message: 10/03/2004, 23h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo