标题:jsp中异常问题
取消只看楼主
王小贱2016
Rank: 1
等 级:新手上路
帖 子:21
专家分:9
注 册:2016-4-23
结帖率:0
 问题点数:0 回复次数:0 
jsp中异常问题
这个是我jsp中的代码
<%
      
      Dept vc=new Dept();
      vc.setDeptno(Integer.parseInt(request.getParameter("deptno")));
      vc.setDname(request.getParameter("dname"));
      vc.setLoc(request.getParameter("loc"));
   
    String msg="部门添加失败";
    boolean a=ServiceFactory.getIDeptService().insert(vc);
    if(a){
        msg="部门信息添加成功";
    }
  
      
  %>
下面是他显示的错误
org.apache.jasper.JasperException: An exception occurred processing JSP page /pages/back/admin/dept/dept_insert_do.jsp at line 33

30:   %>
31:   <%
32:     String msg="閮ㄩ棬娣诲姞澶辫触";
33:     boolean a=ServiceFactory.getIDeptService().insert(vc);
34:     if(a){
35:         msg="閮ㄩ棬淇℃伅娣诲姞鎴愬姛";
36:     }


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)
root cause

java.lang.NullPointerException
    cn.impl.www.DeptDAOImpl.findById(DeptDAOImpl.java:59)
    cn.impl.www.DeptDAOImpl.findById(DeptDAOImpl.java:1)
    cn.service.impl.www.DeptServiceimpl.insert(DeptServiceimpl.java:16)
    org.apache.jsp.pages.back.admin.dept.dept_005finsert_005fdo_jsp._jspService(dept_005finsert_005fdo_jsp.java:94)
    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)
  然而我在dao类测试代码,在dao类中没有问题呀
@Test
    public void testDoCreate() {
        Dept vo =new Dept();
        vo.setDeptno(11);
        vo.setDname("哈哈");
        vo.setLoc("呵呵");
        try {
            TestCase.assertTrue(ServiceFactory.getIDeptService().insert(vo));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

搜索更多相关主题的帖子: jsp service apache servlet java 
2017-11-30 11:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-482951-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.091632 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved