Problème Struts sous Netbeans
slt,vous pouvez m'aider svp je suis en stage mnt et je dois réaliser une application commercial avec j2ee/mysql sous netbeans j'ai commencé par la validation des champs avec les struts j'ai fais les memes etapes que j'ai trouvé dans un tutoriel mais ca marche ps il m'affiche une erreur voila :
Citation:
erreur:
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 /espace_admin/ajout_service.jsp at line 92
89: <p align="center" class="Style23"> </p>
90: <p align="center" class="Style23"> </p>
91:
92: <html:form action="ajout_ser">
93: <table width="259" height="50" border="1" align="center">
94: <tr>
95: <td height="21"><bean:message key="ajout_ser.service"/></td>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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.espace_005fadmin.ajout_005fservice_jsp._jspx_meth_html_005fform_005f0(ajout_005fservice_jsp.java:228)
org.apache.jsp.espace_005fadmin.ajout_005fservice_jsp._jspService(ajout_005fservice_jsp.java:167)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
et voila le code de ma page jsp:
Code:
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
| <%@ 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:form action="ajout_ser">
<table width="259" height="50" border="1" align="center">
<tr>
<td height="21"><bean:message key="ajout_ser.service"/></td>
<td> <div align="center"><strong>
<html:text property="service"/></td>
</tr>
<tr>
<td height="21"><div align="center"><strong>
<html:submit value="enregistrer"/>
</strong></div></td>
<td height="21"> <div align="center"><strong>
<html:reset value="effacer"/>
</strong></div></td>
</tr>
</table>
<html:submit value="valider" />
</html:form> |
code struts-config.xml :
Code:
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
| <struts-config>
<form-beans>
<form-bean name="ProdStrutsActionForm" type="beans.ProdStrutsActionForm"/>
<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_service.jsp" name="NewStrutsActionForm" path="/ajout_ser" scope="session" type="com.myapp.struts.NewStrutsAction"/>
<forward name="success" path="/ajout_service.jsp"/>
</action>
<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> |
code de l'ActionForm:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if(request.getServletPath().equals("/ajout_ser.do")){
if (getService() == null ) {
errors.add("service", new ActionMessage("error.service.required"));
// TODO: add 'error.name.required' key to your resources
}
else{
ajou_ser();
}
}
return errors;
}
public void ajou_ser() {
Session s=NewHibernateUtil.currentSession();
Transaction tx=null;
tx=s.beginTransaction();
service emp=new service(getService());
s.save(service);
tx.commit();
//NewHibernateUtil.closeSession();
} |
application ressource properties :
Citation:
errors.header=<UL>
errors.prefix=<LI>
errors.suffix=</LI>
errors.footer=</UL>
# -- validator --
errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
errors.range={0} is not in the range {1} through {2}.
errors.required={0} is required.
errors.byte={0} must be an byte.
errors.date={0} is not a date.
errors.double={0} must be an double.
errors.float={0} must be an float.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.short={0} must be an short.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.
# -- other --
errors.cancel=Operation cancelled.
errors.detail={0}
errors.general=The process did not complete. Details should follow.
errors.token=Request could not be completed. Operation is not in sequence.
# -- welcome --
error.service.required=service invalid
ajout_ser.service=service
welcome.title=Struts Application
welcome.heading=Struts Applications in Netbeans!
welcome.message=It's easy to create Struts applications with NetBeans.
svp c urgent et merci d'avance
probleme strut sous netbeans
merci pour votre interet mais le meme erreur s'affiche je crois qu'il ya une probleme de la page action "ajout_ser" j'ai verifié plz fois et la meme probleme svp chercher avec moi une solution
Probleme strut sous hibernate
Maintenant, j'ai une autre erreur et je n'ai pas compris de quoi il s'agit.
Est-ce qu'il y a une erreur dans Struts ou Hibernate svp ?
N'hesitez pas à m'aider.
Voilà l'erreur:
Citation:
Etat HTTP 500 -
--------------------------------------------------------------------------------
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_service.jsp at line 88
85: <p align="center" class="Style23"> </p>
86: <p align="center" class="Style23"> </p>
87:
88: <html:form action="ajout_ser" >
89: <table width="203" height="67" border="0" align="center"> <tr>
90: <td width="90" height="21"><div align="center"></div></td>
91: <td width="103"><div align="center">
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
cause mère
javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class beans.NewStrutsActionForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.ajout_005fservice_jsp._jspService(ajout_005fservice_jsp.java:180)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
cause mère
javax.servlet.jsp.JspException: Exception creating bean of class beans.NewStrutsActionForm: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:515)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:482)
org.apache.jsp.ajout_005fservice_jsp._jspx_meth_html_005fform_005f0(ajout_005fservice_jsp.java:197)
org.apache.jsp.ajout_005fservice_jsp._jspService(ajout_005fservice_jsp.java:154)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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.14.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.14
merci d'avance.