1.创建Web项目
File->New->Dynamic Web Project
Project Name输入项目名称
Target runtime->New Runtime 选择Apache Tomcat v7.0->Next->Tomcat installation directory 输入Tomcat解压根目录->Finish
Next->Next->Finish
2.创建Server
Server视窗->New Server->Next->选中项目 Add->Finish
3.创建jsp
右击WebContent文件夹->New->JSP File
创建index.jsp文件
录入以下内容
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<% java.util.Date d = new java.util.Date(); %>
<h1>
Today's date is <%= d.toString() %> and this jsp page worked!
</h1>
</body>
</html>
4.运行
Server视窗->Publish->Run
从浏览器中进入http://localhost:8080/TryWeb/index.jsp
看效果