1、前提:
- 下载tomcat
- 下载jdk
- 下载MyEclipse
2、安装:
跟着安装步骤一步一步安装。3、首个Jsp案例
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'MyJsp.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> <i>My name is Avril Wu </i> </body> </html>
4、发布
4.1、首先配置Myeclipse的Configure Server,配置自己安装的Tomcat服务
4.2、配置Myeclipse的Configure Server,配置自己安装的Tomcat服务
4.3、保存自己的jsp文件于WebRoot目录下,在浏览器中输入http://localhost:8080/projectName/路径名/文件名.jsp就可以啦