首页 新闻 会员 周边 捐助

java.lang.NumberFormatException: null

0
[待解决问题]

register.jsp
年龄:<input type="text" name="uage1" /> <br />

show.jsp
int age1=Integer.parseInt(request.getParameter("uage1"));

老是null..........
HTTP状态 500 - 内部服务器错误

类型 异常报告

消息 在 [18] 行处理 [/showes.jsp] 时发生异常

描述 服务器遇到一个意外的情况,阻止它完成请求。

例外情况
org.apache.jasper.JasperException: 在 [18] 行处理 [/showes.jsp] 时发生异常

15: String pwd = request.getParameter("upwd");
16: String Surname = request.getParameter("uSurname");
17: String name = request.getParameter("uname");
18: int age1=Integer.parseInt(request.getParameter("uage1"));
19: String china = request.getParameter("uchina");
20: String phone = request.getParameter("uphone");
21: String[] hobbies = request.getParameterValues("uhobbies");

Bored to death

问题补充:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<from action ="check.jsp" method = "post" >
用户名:<input type = "text" name = "uname"><br/>
用户密码:<input type = "password" name = "upwd"><br/>
<input type = "submit" value = "登陆"><br/>
</from>
</body>
</html>
《登录页面》
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String name = request.getParameter("uname");
String pwd = request.getParameter("upwd");

	if(name.equals("zs") && pwd.equals("123")){
		//页面跳转,重定向,数据丢失;
		//response.sendRedirect("success.jsp");
		//页面跳转,请求转发;地址栏不变
		request.getRequestDispatcher("success.jsp").forward(request, response);
	} else {

		out.print("用户名或用户密码错误。。。");
	}
%>

</body>
</html>
《检查页面》
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>登陆成功</h1>
<h2>欢迎您。。。</h2>
<%
String name = request.getParameter("uname");
out.print(name);
%>
</body>
</html>
《转至成功页面》
问题是根本跳不动检查页面,服务器也不报错。那后面的成功页面也就是无稽之谈了。。

明月朗朗星为伴的主页 明月朗朗星为伴 | 初学一级 | 园豆:196
提问于:2020-11-21 19:37
< >
分享
所有回答(3)
0

把你提交数据的整个html和js贴上,只看到这一部分很难看出

小高飞 | 园豆:84 (初学一级) | 2020-11-22 16:08
0

request.getRequestDispatcher("success.jsp").forward(request, response);
你在这上面打印一下入参。看看有没有先,一步步分析。

明日小路 | 园豆:466 (菜鸟二级) | 2020-11-23 16:57
0

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action ="check.jsp" method = "post" >
用户名:<input type = "text" name = "uname"><br/>
用户密码:<input type = "password" name = "upwd"><br/>
<input type = "submit" value = "登陆"><br/>
</form>
</body>
</html>

<form></form>这写错了!!!!

明月朗朗星为伴 | 园豆:196 (初学一级) | 2020-11-23 17:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册