龙之谷时装在哪里看:求助:一个有关JSP的问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/09 07:00:02
问题是file.txt中的内容无法正常显示,错误显示(如下)另外,文本中如果全是英文可以显示但是没有格式(就是没有分行,所有内容混在一起),错误显示和文件如下:
type Exception report

message

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

exception

org.apache.jasper.JasperException: /try.jsp(5,0) Invalid byte 2 of 2-byte UTF-8 sequence.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

try.html代码如下:
<html>
<body>
<form name="form1" method="post" action="try.jsp">
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>

try.jsp代码如下:
<%@page contentType="text/html; charset=GB2312" language="java"%>
<%@ include file="\datafile\file.txt" %>

file.txt内容如下:
Mary's new job ____ a change in her living habits.
A.has got
B.have done
C.has worked
D.has managed
C
They entered a boating ____ and won the first prize.
A.competition
B.sport
C.training
D.conflict
A
Our 9-year-old daughter has been ____ us ____ about her examination
results.
A.keeping...in the dark
B.making...in the dark
C.bringing...out of the dark
D.holding...in the dark
A
He ____ elected monitor.
A.stood no chance of being
B.made no chance to be
C.stood no chance to be
D.stood not a chance of being
A

我用TOMCAT5.5 在你的try.jsp下做了下修改

<meta http-equiv="Countent-Type" content="text/html;charset=GBK">
<%@ page contentType="text/html; charset=GBK" %>
<%@ include file="file.txt" %>

测试通过

tomcat 没有配好 把jdk/lib/tools.jar 复制过去