老师,点击编辑报错空白页,然后控制台报错

老师,点击编辑报错空白页,然后控制台报错

java.lang.reflect.InvocationTargetException

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:564)

at com.imooc.sm.global.DispatcherServlet.service(DispatcherServlet.java:51)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at com.imooc.sm.global.EncodingFilter.doFilter(EncodingFilter.java:20)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.base/java.lang.Thread.run(Thread.java:844)

Caused by: java.lang.NumberFormatException: For input string: ""

at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.base/java.lang.Integer.parseInt(Integer.java:662)

at java.base/java.lang.Integer.parseInt(Integer.java:770)

at com.imooc.sm.controller.DepartmentController.edit(DepartmentController.java:50)

... 30 more


http://img1.sycdn.imooc.com//climg/5f58c357099983c906690448.jpg

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

3回答
提问者 阿硕A 2020-09-10 19:13:29

有的老师,还是不可以

  • 同学你好,建议同学具体指出报错的DepartmentController类的第50行是哪句代码?将这里的代码贴一下,方便我们查看具体错误。 祝:学习愉快~
    2020-09-11 09:49:00
好帮手慕阿满 2020-09-10 12:07:01

同学你好,问一下同学DepartmentController类的第50行是那句代码?建议同学指出一下。

这里可能是在编辑部门信息是,没有传入部门id造成的,建议同学查看一下department_edit.jsp页面中是否有部门id,如:

http://img1.sycdn.imooc.com//climg/5f59a6610950e12809570339.jpg

祝:学习愉快~

好帮手慕阿满 2020-09-10 10:02:25

同学你好,报错提示数字格式异常,在DepartmentController的edit()方法中,第50行,如:

http://img1.sycdn.imooc.com//climg/5f5987aa09c8bc2b08160296.jpg

问一下DepartmentController类的第50行代码是什么?

同学是在部门列表页面点击的编辑然后报错吗?点击编辑应该跳转到toEdit.do方法,而不是edit.do,如:

http://img1.sycdn.imooc.com//climg/5f5988fe09f8e74107040147.jpg

建议同学检查并修改再试试。如果不是这里的问题,建议同学详细描述一下。

祝:学习愉快~

  • 提问者 阿硕A #1
    不是,点击编辑能进编辑页面,但是点击保存,进入空白页面
    2020-09-10 10:04:09
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师