黑马程序员技术交流社区

标题: MyEclipse不重启服务器的方法? [打印本页]

作者: C、一个画不完的    时间: 2014-8-3 00:55
标题: MyEclipse不重启服务器的方法?
MyEclipseweb开发修改类文件和配置文件不重启服务器的方法?

作者: niushicha    时间: 2014-8-3 00:56
在java web实际开发中我们在修改配置文件与java代码时往往会重新部署或者重新启动tomcat服务器,为了提高开发效率,进行总结了一下。
一 、修改struts2配置文件不用重启方法
解决方案:
在src目录下新建一个文件struts.xml(struts.properties),打开编辑,加入以下语句
/*
*struts.devMode设置为开发模式(默认false)
*struts.i18n.reload=true 国际化自动重新部署(i18n 一个18位英文单词的缩写)
* struts.configuration.xml.reload  重新加载XML文件
*/
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.configuration.xml.reload" value="true"/>
<include file="edu/njtc/struts2/ognl/ognl.xml"/>
</struts>上面的语句分别为是否为struts开发模式、是否国际化信息自动加载、是否加载xml配置(true,false),重启tomcat后效果。

二:修改java代码(如action)无需重启与部署方法

解决方案:
在WebRoot下的META-INF文件夹中新建一个名为context.xml文件,里面添加如下内容(要区分大小写):
<Context reloadable = "true">

</Context>
作者: niushicha    时间: 2014-8-3 01:01
在java web实际开发中我们在修改配置文件与java代码时往往会重新部署或者重新启动tomcat服务器,为了提高开发效率,进行总结了一下。 一 、修改struts2配置文件不用重启方法 解决方案:  在src目录下新建一个文件struts.xml(struts.properties),打开编辑,加入以下语句 /* *struts.devMode设置为开发模式(默认false) *struts.i18n.reload=true 国际化自动重新部署(i18n 一个18位英文单词的缩写) * struts.configuration.xml.reload  重新加载XML文件 */ <struts> <constant name="struts.devMode" value="true" /> <constant name="struts.configuration.xml.reload" value="true"/> <constant name="struts.configuration.xml.reload" value="true"/> <include file="edu/njtc/struts2/ognl/ognl.xml"/> </struts>上面的语句分别为是否为struts开发模式、是否国际化信息自动加载、是否加载xml配置(true,false),重启tomcat后效果。   二:修改java代码(如action)无需重启与部署方法   解决方案: 在WebRoot下的META-INF文件夹中新建一个名为context.xml文件,里面添加如下内容(要区分大小写): <Context reloadable = "true">  </Context>




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2