日期:2014-05-17  浏览次数:20633 次

添加/修改Eclipse中HTML、JSP等模板

先找到myeclipse模板配置文件

%myeclipse-install%\myeclipse\eclipse\plugins\com.genuitec.eclipse.wizards_5.9.100\templates.xml

以下是该文件的内容:?

<?xml version="1.0" encoding="UTF-8"?>
<templateLibrary>
	<!-- JSP templates -->
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Jsp.vtl"
		name="Default JSP template"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Struts-1.1.vtl"
		name="Standard JSP using Struts 1.1"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Struts-1.1-form.vtl"
		name="Standard JSP using Struts 1.1 with a form"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Struts-1_2.vtl"
		name="Standard JSP using Struts 1.2/1.3"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Struts-1_2-form.vtl"
		name="Standard JSP using Struts 1.2/1.3 with a form"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/JSF.vtl"
		name="Default JSF template"/>
	<template
		context="com.genuitec.eclipse.wizards.jsp"
		script="templates/jsp/Jsp-html.vtl"
		name="Just as HTML"/>


	<!-- HTML templates -->
	<template
		context="com.genuitec.eclipse.wizards.html"
		script="templates/html/Html.vtl"
		name="Default HTML template"/>
	<template
		context="com.genuitec.eclipse.wizards.html"
		script="templates/html/HtmlWithLoginForm.vtl"
		name="HTML template with a form"/>
。
。
。


2、如果要添加模板,将
?<!--Sundy JSP templates -->
?<template
??context="com.genuitec.eclipse.wizards.jsp"
??script="templates/jsp/Jsp-Manager.vtl"
??name="JSP Manager template"/>
??<template
??context="com.genuitec.eclipse.wizards.jsp"
??script="templates/jsp/Jsp-View.vtl"
??name="JSP View template"/>
??<template
??context="com.genuitec.eclipse.wizards.jsp"
??script="templates/jsp/Jsp-Input.vtl"
??name="JSP Input template"/>
加入到templates.xml中,

把相应的模板拷到那个目录中去,

重新启动myeclipse,再新建相应的页面时就会看到我们自己添加的模板了。

3、如果是修改模板的话,找到相应的模板文件修改就行了。