您的位置:首页 > 编程语言 > Java开发

关于修改myeclipse中servlet和jsp模板

2015-03-18 14:06 691 查看
一、修改Servlet模板

1、找到计算机本地中安装的myeclipse路径,按照关键字“wizard*”进行搜索。这里,以myeclipse2014为例,找到com.genuitec.eclipse.wizards_11.5.0.me201310291746.jar。

2、用解压工具打开,找到template文件夹中,Servlet.java文件,并进行修改。

3、 #---------------------------------------------#

# <aw:description>Template for Servlet</aw:description>

# <aw:version>1.1</aw:version>

# <aw:date>04/05/2003</aw:date>

# <aw:author>Ferret Renaud</aw:author>

#---------------------------------------------#

<aw:import>java.io.IOException</aw:import>

<aw:import>java.io.PrintWriter</aw:import>

<aw:import>javax.servlet.ServletException</aw:import>

<aw:import>javax.servlet.http.HttpServlet</aw:import>

<aw:import>javax.servlet.http.HttpServletRequest</aw:import>

<aw:import>javax.servlet.http.HttpServletResponse</aw:import>

<aw:parentClass>javax.servlet.http.HttpServlet</aw:parentClass>

<aw:method name="doGet">

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

}

</aw:method>

<aw:method name="doPost">

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

doGet(request, response);

}

</aw:method>

复制,替换Servlet.java中文件,重启myeclipse,完成!

二、修改jsp模板

1、找到计算机本地中安装的myeclipse路径,按照关键字“wizard*”进行搜索。这里,以myeclipse2014为例,找到com.genuitec.eclipse.wizards_11.5.0.me201310291746.jar。

2、用解压工具打开,找到template文件夹中,Jsp.vtl和JSPMetaTags.vtl文件,并进行修改。

3、Jsp.vtl文件修改:

#*---------------------------------------------#

# Template for a JSP

# @version: 1.2

# @author: Ferret Renaud

# @author: Jed Anderson

#---------------------------------------------#

*#<%@ page language="java" import="java.util.*" pageEncoding="$encoding"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title></title>

#parse( "templates/jsp/JSPMetaTags.vtl" )

</head>

<body>

<br>

</body>

</html>

4、JSPMetaTags.vtl文件:

#*----------------#

# Standard meta tags for JSP files

# @author: Jed Anderson

#-----------------#

*#<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

<!--

<link rel="stylesheet" type="text/css" href="styles.css">

-->

5、替换掉原有文件,重启myeclipse。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: