为什么我foreach遍历有问题

来源:1-11 Servlet获取表单数据

qq_仰望星空_96

2018-07-29 11:55


An exception occurred processing JSP page /UserMessage.jsp at line 69


66: <td>

67: <%

68: String [] favorites=regusebean.getFavority();

69: for(String f:favorites)

70: {

71: %>

72: <%=f %>



Stacktrace:

at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:579)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

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

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

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

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

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

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:716)

at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)

at servlet.DengLuServlet.doPost(DengLuServlet.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

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

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

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

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

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

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

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

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

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

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

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

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

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

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

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

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

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

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException

at org.apache.jsp.UserMessage_jsp._jspService(UserMessage_jsp.java:197)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)

... 36 more


写回答 关注

1回答

  • qq_仰望星空_96
    2018-07-29 12:06:56

    https://img1.mukewang.com/5b5d3d580001c5ee05110245.jpg这是源代码


JAVA遇见HTML——Servlet篇

本门课程在JSP课程的基础上,深入介绍Servlet的基础知识

160615 学习 · 1029 问题

查看课程

相似问题