有时候我们自己如果没有现成的JSP模板时,系统一般会自动生成自带的模板,但这样的一般不是我们想要的,那么就可以修改默认jsp模板。
设置步骤如下: eclipse -- >perferences - >web ->jsp - jsp files -Editor ->templates 在这里可以设置模板。
将 JSP WITH HTMl 里面内容替换为如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
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>标题</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">
</head>
<body>
${cursor}
</body>
</html>