问题描述
- 一个简单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
解决方案
我测试了一下,没有问题啊``这回答里面不能贴图片,不然截图给你看看
时间: 2024-08-03 11:49:12