请问下这个错误是什么啊?我看不太懂这些错误信息,麻烦稍微教我一点怎么去看这些信息。我想把form表单提交的width和height转换为int类型,我记得昨天还能成功的.
今天就一直出现这个莫名其妙的问题。 顺便问下,我登录了csdn怎么老是会自动退出登录的?害我写好的帖子丢了好几次了type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Exception in JSP: /dongtaibiao.jsp:1916: <% String[] colorArray={"00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"};%>
17: <% String w =request.getParameter("width");
18: String h =request.getParameter("height");
19: int a =Integer.valueOf(w);
20: int b =Integer.valueOf(h);%>
21:
22:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.valueOf(Unknown Source)
org.apache.jsp.dongtaibiao_jsp._jspService(dongtaibiao_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.28 logs.
--------------------------------------------------------------------------------Apache Tomcat/5.5.28原代码是
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="dongtaibiao.jsp" method="post" name="form1">
<input name="width" type="text" value="3">
<input name="height" type="text" value="3">
<input name="" type="submit" value="GO"></form>
<% String[] colorArray={"00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"};%>
<% String w =request.getParameter("width");
String h =request.getParameter("height");
int a =Integer.valueOf(w);
int b =Integer.valueOf(h);%>
<%=w%>
</body>
</html>
今天就一直出现这个莫名其妙的问题。 顺便问下,我登录了csdn怎么老是会自动退出登录的?害我写好的帖子丢了好几次了type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Exception in JSP: /dongtaibiao.jsp:1916: <% String[] colorArray={"00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"};%>
17: <% String w =request.getParameter("width");
18: String h =request.getParameter("height");
19: int a =Integer.valueOf(w);
20: int b =Integer.valueOf(h);%>
21:
22:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.valueOf(Unknown Source)
org.apache.jsp.dongtaibiao_jsp._jspService(dongtaibiao_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.28 logs.
--------------------------------------------------------------------------------Apache Tomcat/5.5.28原代码是
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.lang.*" %>
<%@ page import="java.util.*" %>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="dongtaibiao.jsp" method="post" name="form1">
<input name="width" type="text" value="3">
<input name="height" type="text" value="3">
<input name="" type="submit" value="GO"></form>
<% String[] colorArray={"00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"};%>
<% String w =request.getParameter("width");
String h =request.getParameter("height");
int a =Integer.valueOf(w);
int b =Integer.valueOf(h);%>
<%=w%>
</body>
</html>
String h =request.getParameter("height");
int a =Integer.valueOf(w);
int b =Integer.valueOf(h);%>
强制转换用int a =Integer.parseInt(w)
int b =Integer.parseInt(h)
但是还是出现同样的问题。当我删掉
int a =Integer.valueOf(w);
int b =Integer.valueOf(h);时
使用<%=w%>是可以正常显示出数据的
int a =Integer.valueOf(w);
int b =Integer.valueOf(h);时是正常的,点提交可以显示输入的w的值
所以无法转换。。
或者你提交到另外一个jsp里面,把这个jsp复制过去
再问下,怎么样才可以把form表单和转换的程序放一个jsp文件里呢?