2 godlovesoccer godlovesoccer 于 2014.09.28 10:44 提问

一个简单jsp文件检查了好几遍不知道为什么报错,求高手指点

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
Locale locale = request.getLocale();

Calendar calendar = Calendar.getInstance(locale);

int hour = calendar.get(Calendar.HOUR_OF_DAY);

String greeting = "";

if (hour <= 6) {
    greeting = "凌晨好,您该睡觉了。良好的睡眠是美好一天的开始。";
} else if (hour <= 9) {
    greeting = "早上好。早餐应该注意营养。";
} else if (hour <= 12) {
    greeting = "上午好。工作时注意保护眼睛。";
} else if (hour <= 18) {
    greeting = "下午好。小心工作中打瞌睡。";
} else if (hour <= 24) {
    greeting = "晚上好。放松一下自己,好好休息。睡觉不要太晚啊~~";
} else {

}

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


欢迎页面











<%= greeting %>

jsp的页面在Eclipse下写的,启动tomcat,然后用Eclipse的浏览器访问(http://localhost:8080/jsp/greeting.jsp)

报错
type Exception report
message /greeting.jsp (line: 2, column: 9) quote symbol expected
description The server encountered an internal error that prevented it from fulfilling this request.
exception

1个回答

D1208
D1208   2014.09.28 15:33

我测试了一下,没有问题啊``这回答里面不能贴图片,不然截图给你看看

godlovesoccer
godlovesoccer 谢谢,我觉得也没问题,我检查了好久,估计是Eclipse哪编译有问题
大约 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片