description The server encountered an internal error that prevented it from fulf

HZD3432 2017-06-29 07:55:29
type Exception report

message

description The server encountered an internal error that prevented it from fulfilling this request.

exception
java.lang.NullPointerException
com.zd.Add.doGet(Add.java:52)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)



note The full stack trace of the root cause is available in the Apache Tomcat/7.0.57 logs.
...全文
207 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
HZD3432 2017-06-29
  • 打赏
  • 举报
回复
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String sno = request.getParameter("sno"); String n = new String(sno.getBytes("ISO-8859-1"),"utf-8"); String sname = request.getParameter("sname"); String p = new String(sname.getBytes("ISO-8859-1"),"utf-8"); String sex = request.getParameter("sex"); String sx = new String(sex.getBytes("ISO-8859-1"),"utf-8"); String birth = request.getParameter("birth"); String bth = new String(birth.getBytes("ISO-8859-1"),"utf-8"); String major = request.getParameter("major"); String ty = new String(major.getBytes("ISO-8859-1"),"utf-8"); String xuefen = request.getParameter("xuefen"); String xf = new String(xuefen.getBytes("ISO-8859-1"),"utf-8"); test t = new test(); Document xmldoc = t.JX("D:/Eclipse/eclipse/workspace/Student/student.xml"); Element thestudent = null, theElem = null, root = null; root = xmldoc.getDocumentElement(); thestudent = xmldoc.createElement("student"); theElem = xmldoc.createElement("学号"); theElem.setTextContent(n); thestudent.appendChild(theElem); theElem = xmldoc.createElement("姓名"); theElem.setTextContent(p); thestudent.appendChild(theElem); theElem = xmldoc.createElement("性别"); theElem.setTextContent(sx); thestudent.appendChild(theElem); theElem = xmldoc.createElement("出生日期"); theElem.setTextContent(bth); thestudent.appendChild(theElem); theElem = xmldoc.createElement("专业名"); theElem.setTextContent(ty); thestudent.appendChild(theElem); theElem = xmldoc.createElement("已修学分"); theElem.setTextContent(xf); thestudent.appendChild(theElem); root.appendChild(thestudent); t.saveXml("D:/Eclipse/eclipse/workspace/Student/student.xml",xmldoc); // String id = request.getParameter("id"); response.setContentType("text/html; charset=gb2312"); ServletContext sc = getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher("show.jsp"); //定向的页面 rd.forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } 这个哪里有错吗?
李德胜1995 2017-06-29
  • 打赏
  • 举报
回复
Add.doGet(Add.java:52)。。。52行空指针

58,453

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧