为什么我运行
<%@ page language="java" contentType="text/html" pageEncoding="gb2312"%>
<html>
<head>
<title>request中的getparameter()方法</title>
</head>
<body>
<%--在这里设定request得到参数的字符编码,否则中文会出现乱码 --%>
<%request.setCharacterEncoding("gb2312");%>
得到用户输入的信息:<p>
<font color=red>姓名:<%=request.getParameter("name").toString()%><p>
性别:<%=request.getParameter("sex").toString()%><p>
年龄:<%=request.getParameter("age").toString()%><p>
</font>
获取按钮标记名:
<font color=blue>
<%=request.getParameter("submit").toString()%>
</font>
</body>
</html>
时候会显示如下错误
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
root cause
谁能帮我解答 谢谢
------解决方案--------------------
name,sex,age,submit这些属性都有吗?他们当中应该有一个为null
代码迷推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.daimami.com/search?q=317