No.1:
关闭MyEclipse,找到文件MyEclipse\Common\plugins\com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar(注意不同的版本,这个文件后面的数字不一样,不要惊慌),备份之。
No.2:
创建文件Custom.vtl,在里面编辑自己定义的Jsp代码模板,例如:
保存之。。<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Custom JSP '$title' starting page</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <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"> <link rel="SHORTCUT ICON" href="ico.ico"> </head> <body> This is my JSP page. <br> </body> </html>
No.3:
使用winrar软件打开第一步的jar包,并切换至com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar\templates\jsp目录,如图:
No.4:
将第二步创建的Custom.vtl文件拖放至第三步图中的目录下,确认将其压缩至com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar包中
No.5:
打开包com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar中的templates.xml文件,在<templateLibrary>标签内添加如下代码:
<template context="com.genuitec.eclipse.wizards.jsp" script="templates/jsp/Custom.vtl" name="Custom Jsp template"/>
其中的name属性的值是可以自定义的哦,然后保存,确保这个被修改后的templates.xml放置在com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar包中相应的位置上。
No.6:启动MyEclipse,创建一个新的Jsp,测试一下效果吧,如果一切顺利,效果如下图所示:
No.7:结束了,大功告成喽。。。