使用tomcat部署jsp页面,tomcat运行成功,访问时报500错误

type Exception report

message

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

exception
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 119 in the jsp file: /index.jspformater cannot be resolved116: <div class="titles">117: 镇ㄥソ锛屼粖澶╂槸118: <% SimpleDateFormat formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); %>119: <%! String currentTime = formater.format(new Date());%>120: <% =currentTime %>

页面上嵌入的java代码,但是却没有引入相应的包,也会报这个错。比如在页面上写了,List list=new ArrayList();就应该添加<%@ page import="java.util.*"%>
你这里要导入import java.text.SimpleDateFormat;import java.util.Date;
温馨提示:内容为网友见解,仅供参考
第1个回答  2014-01-09
这明显就是你的乱码的问题!你把这个JSP页面的第119行的那几个汉字都去掉,如果是后台传进来的就需要统一编码!jsp页面里在最上面看有一个<meta>的标签里有content的元素设置成和你后台编码一样的就可以。追问

把那段文字删了,还是报错了
An error occurred at line: 118 in the jsp file: /index.jsp
。。。118:

追答

那你把。。。也删掉试试,如果是乱码的问题你弄。。。也不行的

第2个回答  推荐于2016-07-12
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.text.*,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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
SimpleDateFormat formater = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
%>
<%String currentTime = formater.format(new Date());%>
<%=currentTime%>
</body>
</html>

本回答被提问者采纳
第3个回答  2014-01-09
500为服务器配置错误
检查项目的配置文件是否有错误的地方
第4个回答  2014-01-09
这是你的jsp页面有问题追问

使用的java脚本,是从Eclipes中拷贝过来的

追答

其实下面回答的很全面了,要导入 java.text.SimpleDateFormat;import java.util.Date;你把这个JSP页面的第119行的那几个汉字都去掉,还有中的!去掉

相似回答