【发布时间】:2021-12-02 00:16:50
【问题描述】:
这是我第一次使用 Eclipse 和 Tomcat。
我想添加一个包含以下 HTML/JSP 内容的index,jsp 文件。
<%@ page import java.util.Date()%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Message of the Day Application</title>
</head>
<body bgcolor="green">
<h1 align="center">Welcome to MOTD Application</h1>
<h1 align="center">Version 2.0</h1>
<h1>Message of the Day: Cloud Computing is Cooler!</h1>
<h2>The date and time now is <%= new java.util.Date() %></h2>
</body>
</html>
错误:
java.util.Date cannot be resolved to a type
java.util.Date() 在</body> 之前的行中引发错误
【问题讨论】:
-
<%@ page import="java.util.Date" %>代替<%@ page import java.util.Date()%>有效吗? -
不,它不起作用