当前位置: 代码迷 >> Eclipse >> The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.
  详细解决方案

The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

热度:936   发布时间:2016-04-23 14:14:47.0
接收数据的Servlet错误
The server encountered an internal error () that prevented it from fulfilling this request.

exception 

java.io.UnsupportedEncodingException: GB2321
sun.io.Converters.getConverterClass(Converters.java:218)
sun.io.Converters.newConverter(Converters.java:251)
sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:68)
sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:189)
sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:172)
sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:72)
java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:82)
org.apache.tomcat.util.buf.WriteConvertor.<init>(C2BConverter.java:168)
org.apache.tomcat.util.buf.C2BConverter.<init>(C2BConverter.java:47)
org.apache.catalina.connector.OutputBuffer.setConverter(OutputBuffer.java:579)
org.apache.catalina.connector.OutputBuffer.checkConverter(OutputBuffer.java:545)
org.apache.catalina.connector.Response.getWriter(Response.java:619)
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)
acceptUserRegist.doPost(acceptUserRegist.java:27)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.

我的WEB.XML文件里已经有添加:
 <servlet>
<servlet-name>acceptUserRegist</servlet-name>
<servlet-class>acceptUserRegist</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>acceptUserRegist</servlet-name>
<url-pattern>/servlet/acceptUserRegist</url-pattern>
</servlet-mapping>
我的提交数据的页面代码userRegister.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<script language="javascript">
function on_submit()
{//验证数据的合法性
if (form1.username.value == "")
{
alert("用户名不能为空,请输入用户名!");
form1.username.focus();
return false;
}
if (form1.userpassword.value == "")
{
alert("用户密码不能为空,请输入密码!");
form1.userpassword.focus();
return false;
}
if (form1.reuserpassword.value == "")
{
alert("用户确认密码不能为空,请输入密码!");
form1.reuserpassword.focus();
return false;
}
if (form1.userpassword.value != form1.reuserpassword.value)
{
alert("密码与确认密码不同");
form1.userpassword.focus();
return false;
}
if (form1.email.value.length!= 0)
{
for (i=0; i<form1.email.value.length; i++)
if(form1.email.value.charat(i)=="@")
break;
if (i==form1.email.value.length)
{
alert("非法E-mail地址!");
form1.email.focus();
return false;
}
}
else
{
alert("请输入E-mail!");
form1.e-mail.focus();
return false;
}
}
</script>
<html>
<head>
<title>新用户注册</title>
</head>
<body>
<form method="POST" action="servlet/acceptUserRegist" name="form1" onsubmit="return on_submit()">
新用户注册<br>
用户名(*):<input type="text" name="username" size="20"><br>
密码(*):<input type="password" name="userpassword" size="20"><br>
再输入一次密码(*):<input type="password" name="reuserpassword" size="20"><br>
性别:<input type="radio" value="男" checked name="sex">男<input type="radio" name="sex" value="女">女<br>
出生年月:<input name="year" size="4" maxlength=4>年
<select name="month">
  相关解决方案