`
蓝色飞扬
  • 浏览: 93036 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

My eclipse5.5 添加xml 模板

    博客分类:
  • java
阅读更多

Myeclipse5.5本身只有四个xml模板
1、Default XML template,
2、XML template for a web.xml,
3、XML template for a web.xml file with Struts ,
4、XML template for a struts-config.xml
如果我们想新建一个xml文件,而没有这样一个模板时这时候就可以自己加一个模板进去。这样以后开发就不用记那样条目了。
现举例加入ejb的weblogic-ejb-jar.xml配置文件的模板
如图:

­
1、打开打开目录myeclipse\eclipse\plugins\com.genuitec.eclipse.wizards_5.5.1
其中涉及文件为:templates.xml,这是一个模板的配置文件
打开可以见到:
<!-- XML templates -->
<template
  context="com.genuitec.eclipse.wizards.xml"
  script="templates/xml/Xml.vtl"
  name="Default XML template"/>
<template
  context="com.genuitec.eclipse.wizards.xml"
  script="templates/xml/WebXml.vtl"
  name="XML template for a web.xml file"/>
<template
  context="com.genuitec.eclipse.wizards.xml"
  script="templates/xml/WebXmlStruts.vtl"
  name="XML template for a web.xml file with Struts"/>
<template
  context="com.genuitec.eclipse.wizards.xml"
  script="templates/xml/StrutsConfig.vtl"
  name="XML template for a struts-config.xml file"/>
这既为在Eclipse中向导中出现的项目.
2、现在手工进行更改配置文件,在其中加入:
<template
  context="com.genuitec.eclipse.wizards.xml"
  script="templates/xml/weblogic-ejb-jar.vtl"
  name="XML template for a weblogic-ejb-jar.xml file"/>
意为添加一项,模板文件是templates/xml目录下的weblogic-ejb-jar.vtl文件
3、加入模板文件
  在templates/xml目录下新建一个"weblogic-ejb-jar.vtl"文件:(可以复制原有的模板文件然后在修改)
#*---------------------------------------------#
# Template for a weblogic-ejb-jar file
# @version: 1.0
# @date: 04/17/2009
# @author:
#---------------------------------------------#
*#<?xml version="1.0" encoding="$encoding"?>
<weblogic-ejb-jar http://www.bea.com/ns/weblogic/90">http://www.bea.com/ns/weblogic/90" xmlns:http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLhttp://www.bea.com/ns/weblogic/90">http://www.bea.com/ns/weblogic/90http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsdhttp://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
  <weblogic-enterprise-bean>
    <ejb-name>ejbname</ejb-name>
    <jndi-name>jndiname</jndi-name>
  </weblogic-enterprise-bean>
</weblogic-ejb-jar>
­
4、完成.重启Eclipse即可见到效果。
­
如果想添加jsp ,html,xhtml, Applet Java Class等都可以这样添加。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics