空指针异常??

来源:3-7 request对象(上)

慕运维7154151

2017-04-24 22:02

java.lang.NullPointerException

type Exception report

message An exception occurred processing JSP page /request.jsp at line 30

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

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /request.jsp at line 30

27:     用户å��:<%=request.getParameter("username") %><br>
28:     爱好:<%
29:     String[] favorites = request.getParameterValues("favorite");
30:     for(int i=0;i<favorites.length;i++)
31:     {
32:     out.println(favorites[i]+"&nbsp;&nbsp;");
33:     }

代码如下

  <body>

    <h1>request内置对象</h1>

    用户名:<%=request.getParameter("username") %><br>

    爱好:<%

    String[] favorites = request.getParameterValues("favorite");

    for(int i=0;i<favorites.length;i++)

    {

    out.println(favorites[i]+"&nbsp;&nbsp;");

    }

    %>


写回答 关注

1回答

  • 游侠慕兵
    2017-04-25 13:00:33

    你是不是页面跳转前在爱好选项上没有勾选

JAVA遇见HTML——JSP篇

Java Web入门级教程JSP,带你轻松的学习JSP基础知识

248277 学习 · 3071 问题

查看课程

相似问题