org.apache.jasper.JasperException:处理JSP页面时发生异常

时间:2014-06-29 11:14:25

标签: java mysql spring hibernate jsp

Hello Geeks我一直在努力学习如何使用表单:从sprng表单将数据从jsp文件中的表单保存到mysql数据库,我不断收到此错误,请知道我可以连接到我的数据库&导致错误的字段存在

        type Rapport d''exception
message An exception occurred processing JSP page /jsps/AddEmp.jsp at line 26
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 /jsps/AddEmp.jsp at     line 26
23: </tr>
24: <tr>
25: <td width="150"></td><td width="120"></td>
26: <td width="130" align="center"><form:input path="matPer"/></td>
27: <td align="right" width="150"><label>  *  </label><label>رمز المستخدم</label> 
28: </td>
29: </tr>
Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
cause mère 
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'P'     available as request attribute
    org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
        org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus        (AbstractDataBoundFormElementTag.java:175)
        org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath    (AbstractDataBoundFormElementTag.java:195)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName        (AbstractDataBoundFormElementTag.java:161)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId    (AbstractDataBoundFormElementTag.java:148)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId    (AbstractDataBoundFormElementTag.java:139)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttri    butes(AbstractDataBoundFormElementTag.java:123)
    org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes    (AbstractHtmlElementTag.java:409)
    org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140)
    org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal    (AbstractFormTag.java:91)
    org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag    (RequestContextAwareTag.java:78)
    org.apache.jsp.jsps.AddEmp_jsp._jspx_meth_form_005finput_005f0(AddEmp_jsp.java:440)
    org.apache.jsp.jsps.AddEmp_jsp._jspx_meth_form_005fform_005f0(AddEmp_jsp.java:252)
    org.apache.jsp.jsps.AddEmp_jsp._jspService(AddEmp_jsp.java:172)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

我的maven spring hibernate项目具有以下结构:

GP     CONTROLES     MODELES     服务 Web应用程序     JSP页面     WEB-INF        配置 这是jsp文件的一部分

<form:form commandName="P" action="${pageContext.request.contextPath}/Controles/addPermanent.do" method="post">
   <td width="130" align="center"><form:input path="matPer"/></td>

这是我的控制器

@RequestMapping(value="/jsps/addPermanent")
 public String add(@ModelAttribute("P") Permanent permanent , BindingResult result){
        employe.AddEmploye(permanent);
        System.out.println("employe added successufully" );
        System.out.println("result has error"+ result.hasErrors());
     return "ListE";
 }

如果您有任何好的教程或者您遇到过这个问题,请告诉我原因是什么?帮我解决 最好的祝福。

0 个答案:

没有答案