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 :

Probleme struts sous netbeans


Sujet :

Struts 1 Java

  1. #1
    Membre confirmé
    Femme Profil pro
    Stagiaire
    Inscrit en
    Août 2009
    Messages
    148
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Stagiaire
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2009
    Messages : 148
    Par défaut Probleme struts sous netbeans
    Slt a tous,

    je suis en train de realiser une application en j2ee/mysql mais je n'avance pas à cause d'un probleme en struts.

    voila l'erreur:

    type Rapport d'exception

    message

    description Le serveur a rencontr� une erreur interne () qui l'a emp�ch� de satisfaire la requ�te.

    exception

    org.apache.jasper.JasperException: An exception occurred processing JSP page /ajout_client.jsp at line 46

    43: </tr>
    44: <tr>
    45: <td valign="top" height="100%"><p>&nbsp;</p>
    46: <html:form action="ajou_clt.do" >
    47:
    48: <table width="567" height="372" border="0" align="center">
    49: <tr>


    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

    cause m�re

    java.lang.NullPointerException: Module 'null' not found.
    org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:755)
    org.apache.struts.taglib.TagUtils.getModuleConfig(TagUtils.java:735)
    org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:796)
    org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:467)
    org.apache.jsp.ajout_005fclient_jsp._jspx_meth_html_005fform_005f0(ajout_005fclient_jsp.java:157)
    org.apache.jsp.ajout_005fclient_jsp._jspService(ajout_005fclient_jsp.java:112)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

    note La trace compl�te de la cause m�re de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/6.0.18.
    voila mon code jsp:
    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
    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
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
     
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
     
     
    <html>
    <head>
    <title>60</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>
    .text  {font-family:Arial;font-size:10;color:#FFFFFF;}
    .top   {font-family:Arial;font-size:10;color:#384F74;padding-left:5px;padding-right:5px;}
    A.mid   {font-family:Arial;font-size:10;color:#FFC000;}
    A.bot   {font-family:Arial;font-size:10;color:#000000;padding-left:10px;padding-right:10px;}
    A:hover {color:#9CA6B2;}
    .Style10 {font-size: 18px; font-weight: bold; color: #000000; font-style: italic; }
    .Style12 {color: #000000; font-style: italic; font-weight: bold;}
    .Style19 {font-size: 18px}
    .Style24 {color: #FFFFFF}
    .Style25 {color: #000000; }
    </style>
    </head>
     
    <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
    <table width="74%" height="126%" border="0" align="center" cellpadding="0" cellspacing="0">
    	<tr><td height="147" colspan="2" valign="top"><img src="images/main.jpg" border="0"></td>
    	<td width="100%" background="images/mainn.jpg"></td></tr>
    	<tr>
    	  <td valign="top" height="470">&nbsp;</td>
     <td valign="top" height="470"><table width="766" height="62%" border="0" align="center" cellpadding="0" cellspacing="0">
    			<tr>
    				<td valign="top">
    					<table border="0" cellpadding="0" cellspacing="0" background="images/lineR.jpg" width="765" height="41">
    						<tr>
    							<td width="601" style="padding-left:40px;"><font class="top" style="padding-left:30px;"><a href="" class="top">Ajouter_client</a> / <a href="" class="top">Modifier_client</a> / <a href="" class="top">Supprimer_client /</a><a href="" class="top">Rechercher_client</a> / Consulter_client</font></td>
    						  <td width="10" align="right">&nbsp;</td>
    						</tr>
    					</table>				</td>
    			</tr>
    			<tr>
    				<td valign="top" height="100%"><p>&nbsp;</p>
                                       <html:form action="ajou_clt.do" >
     
                                  <table width="567" height="372" border="0" align="center">
                        <tr>
                          <td width="153" rowspan="19" bgcolor="#FFFFFF"><img src="image/Crystal_Clear_app_Login_Manager.png" width="128" height="128"></td>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="nom_clt" />
                            </span></td>
                        </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style25"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="prenom_clt" />
                            </span></td>
                        </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="adresse_clt" />
                            </span></td>
                          </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="tel_clt" />
                            </span></td>
                          </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="gsm_clt" />
                            </span></td>
                          </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="email_clt" />
                            </span></td>
                        </tr>
                        <tr>
                          <td height="21"><div align="center"><span class="Style24"></span></div></td>
                          <td><div align="center">
                              <span class="Style24"><strong>
                              <html:errors property="fax_clt" />
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.nom_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="nom_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.prenom_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="prenom_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.adresse_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="adresse_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.tel_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="tel_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.gsm_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="gsm_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.email_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="email_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="17"><bean:message key="ajou_clt.fax_clt"/></td>
                          <td><div align="center">
                              <span class="Style25"><strong>
                              <html:text property="fax_clt"/>
                            </span></td>
                        </tr>
                        <tr>
                          <td height="46" colspan="2" bgcolor="#FFFFFF"><em><strong>
                            <input name="Submit" type="submit" class="Style10" value="Ajouter" />
                          </strong></em></td>
                        </tr>
                                  </table></html:form>
    			      <p>&nbsp;</p>
    			    <p>&nbsp;</p>
    			    <p>&nbsp;</p>
    			    <p>&nbsp;</p></td>
    			</tr>	
    			<tr><td background="images/line_bot.jpg" height="19" width="765" align="center">&nbsp;</td>
    			</tr>
    					 <tr>
     
    		 	<td width="1" height="2"></td>
    		 </tr>
    	  </table>	 </td>
    	 <td valign="top" width="100%">
    	 <table border="0" cellpadding="0" cellspacing="0" width="2%" height="100%">
    	 	<tr><td background="images/srchN.jpg"><img src="images/srchN.jpg" border="0"></td></tr>
    	 </table>	</td>
    	</tr>
    </table>
    </body>
    </html>
    code beans:
    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
    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
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    package beans;
     
    import javax.servlet.http.HttpServletRequest;
     
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    import org.hibernate.Session;
    import org.hibernate.Transaction;
    import javax.servlet.http.HttpSession;
    //import org.apache.jasper.compiler.Node.ForwardAction;
    import org.hibernate.Query;
    //import org.hibernate.SessionFactory;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
     
    /**
     *
     * @author Miss Kouk@
     */
    public class NewStrutsActionForm extends org.apache.struts.action.ActionForm {
            private Integer idAdmin;
            private String loginAdmin;
            private String passAdmin;
            private int idClt;
             private Administrateur administrateur;
            private String nom;
            private String prenom;
            private String adresse;
            private Integer tel;
            private Integer gsm;
            private String email;
            private Integer fax;
     
        public NewStrutsActionForm(Integer idAdmin, String loginAdmin, String passAdmin, int idClt, Administrateur administrateur, String nom, String prenom, String adresse, Integer tel, Integer gsm, String email, Integer fax) {
            this.idAdmin = idAdmin;
            this.loginAdmin = loginAdmin;
            this.passAdmin = passAdmin;
            this.idClt = idClt;
            this.administrateur = administrateur;
            this.nom = nom;
            this.prenom = prenom;
            this.adresse = adresse;
            this.tel = tel;
            this.gsm = gsm;
            this.email = email;
            this.fax = fax;
        }
     
     
        public Integer getIdAdmin() {
            return idAdmin;
        }
     
        public String getLoginAdmin() {
            return loginAdmin;
        }
     
        public String getPassAdmin() {
            return passAdmin;
        }
     
        public void setIdAdmin(Integer idAdmin) {
            this.idAdmin = idAdmin;
        }
     
        public void setLoginAdmin(String loginAdmin) {
            this.loginAdmin = loginAdmin;
        }
     
        public void setPassAdmin(String passAdmin) {
            this.passAdmin = passAdmin;
        }
     
        public Administrateur getAdministrateur() {
            return administrateur;
        }
     
        public void setAdministrateur(Administrateur administrateur) {
            this.administrateur = administrateur;
        }
     
        public String getAdresse() {
            return adresse;
        }
     
        public void setAdresse(String adresse) {
            this.adresse = adresse;
        }
     
        public String getEmail() {
            return email;
        }
     
        public void setEmail(String email) {
            this.email = email;
        }
     
        public Integer getFax() {
            return fax;
        }
     
        public void setFax(Integer fax) {
            this.fax = fax;
        }
     
        public Integer getGsm() {
            return gsm;
        }
     
        public void setGsm(Integer gsm) {
            this.gsm = gsm;
        }
     
        public int getIdClt() {
            return idClt;
        }
     
        public void setIdClt(int idClt) {
            this.idClt = idClt;
        }
     
        public String getNom() {
            return nom;
        }
     
        public void setNom(String nom) {
            this.nom = nom;
        }
     
        public String getPrenom() {
            return prenom;
        }
     
        public void setPrenom(String prenom) {
            this.prenom = prenom;
        }
     
        public Integer getTel() {
            return tel;
        }
     
        public void setTel(Integer tel) {
            this.tel = tel;
        }
     
        public NewStrutsActionForm() {
            super();
            // TODO Auto-generated constructor stub
        }
     
        /**
         * This is the action called from the Struts framework.
         * @param mapping The ActionMapping used to select this instance.
         * @param request The HTTP Request we are processing.
         * @return
         */
        public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {
           HttpSession session = request.getSession(true);
            HttpSession session2 = request.getSession(true);
            ActionErrors errors = new ActionErrors();
     
             if(request.getServletPath().equals("/ajou_clt.do")){
     
            if (getNom().equals("")  || getNom().length() < 2 ) {
                errors.add("nom", new ActionMessage("error.nom.required"));
                // TODO: add 'error.name.required' key to your resources
            }
            if (getPrenom().equals("")  || getPrenom().length() < 2 ) {
                errors.add("prenom", new ActionMessage("error.prenom.required"));
                // TODO: add 'error.name.required' key to your resources
            }
           else{
              ajou_clt( nom,  prenom,  adresse,  tel,  gsm,  email, fax);
           }}
            return errors;
        }
     
    public void ajou_clt(String nom, String prenom, String adresse, Integer tel, Integer gsm, String email, Integer fax) {
     
    session1.beginTransaction();
    Transaction tx2 = null;
    tx2=session1.beginTransaction();
    Client ad2 =new Client();
    session1.save(ad2);
    tx2.commit();
      SessionFactory fact = new Configuration().configure().buildSessionFactory();
               Session sessionlog =fact.openSession();
     
        }
     Session session1 =NewHibernateUtil.currentSession();
     
     
    }
    code strut config:
    Code xml : 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
    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
    <?xml version="1.0" encoding="UTF-8" ?>
     
    <!DOCTYPE struts-config PUBLIC
              "-//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="NewStrutsActionForm" type="beans.NewStrutsActionForm"/>
        </form-beans>
        <global-exceptions>
     
        </global-exceptions>
     
        <global-forwards>
            <forward name="welcome"  path="/Welcome.do"/>
        </global-forwards>
     
        <action-mappings>
              <action input="/ajout_client.jsp" name="NewStrutsActionForm" path="/ajou_clt"
            scope="session" type="com.myapp.struts.NewStrutsAction"/>
            <forward name="success" path="/ajout_client.jsp"/>
            </action>
            <action input="/" name="NewStrutsActionForm" path="/a" scope="session" type="com.myapp.struts.NewStrutsAction"/>
        </action-mappings>
     
        <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
     
        <message-resources parameter="com/myapp/struts/ApplicationResource"/>    
     
        <!-- ========================= Tiles plugin ===============================-->
        <!--
        This plugin initialize Tiles definition factory. This later can takes some
        parameters explained here after. The plugin first read parameters from
        web.xml, thenoverload them with parameters defined here. All parameters
        are optional.
        The plugin should be declared in each struts-config file.
        - definitions-config: (optional)
        Specify configuration file names. There can be several comma
        separated file names (default: ?? )
        - moduleAware: (optional - struts1.1)
        Specify if the Tiles definition factory is module aware. If true
        (default), there will be one factory for each Struts module.
        If false, there will be one common factory for all module. In this
        later case, it is still needed to declare one plugin per module.
        The factory will be initialized with parameters found in the first
        initialized plugin (generally the one associated with the default
        module).
        true : One factory per module. (default)
        false : one single shared factory for all modules
        - definitions-parser-validate: (optional)
        Specify if xml parser should validate the Tiles configuration file.
        true : validate. DTD should be specified in file header (default)
        false : no validation
     
        Paths found in Tiles definitions are relative to the main context.
        -->
        <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>
     
        <!-- ========================= Validator plugin ================================= -->
        <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>

    merci d'avance

  2. #2
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    La plupart du temps, on obtient ce message lorsqu'il y a une erreur au parsing du fichier struts-config.xml.

    Dans le struts-config.xml, il y a une erreur dans le mapping suivant :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <action input="/ajout_client.jsp" name="NewStrutsActionForm" path="/ajou_clt"
            scope="session" type="com.myapp.struts.NewStrutsAction"/>
            <forward name="success" path="/ajout_client.jsp"/>
    </action>
    Tu as fermé la balise action alors qu'elle contient une balise forward.
    Il faut donc plutôt coder :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <action input="/ajout_client.jsp" name="NewStrutsActionForm" path="/ajou_clt"
            scope="session" type="com.myapp.struts.NewStrutsAction">
            <forward name="success" path="/ajout_client.jsp"/>
    </action>

    Sinon, dans le mapping suivant :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <action input="/" name="NewStrutsActionForm" path="/a" scope="session" type="com.myapp.struts.NewStrutsAction"/>
    Dans l'attribut input, il faut spécifier la ressource (jsp ou autre) qui sera appelée en cas d'erreur de validation.

    Et enfin, dans l'ActionForm NewStrutsActionForm, il faut ajouter un constructeur sans argument.

Discussions similaires

  1. Probleme Glassfish sous Netbeans
    Par sofasr dans le forum NetBeans
    Réponses: 1
    Dernier message: 27/04/2011, 12h11
  2. Problème Struts sous Netbeans
    Par Miss kouka dans le forum Struts 1
    Réponses: 13
    Dernier message: 10/08/2009, 10h42
  3. probleme d'installation plugin easy strut sous eclipse ?
    Par ouadie99 dans le forum Eclipse Java
    Réponses: 4
    Dernier message: 15/01/2007, 21h15
  4. probleme avec Tomcat sous Netbeans 5.0
    Par rastayo dans le forum NetBeans
    Réponses: 4
    Dernier message: 07/08/2006, 14h05
  5. Probleme avec Tomcat sous Netbeans 5.0
    Par rastayo dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 02/08/2006, 17h24

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