eclipse for javaee配备web开发环境

eclipse for javaee配置web开发环境
1、到www.eclipse.org下载eclipse for javaee版本的Eclipse,截止目前最高版本是3.6

2、安装tomcat6.x,这是一个比较稳定的版本

3、在Eclipse中安装tomcat插件,com.sysdeo.eclipse.tomcat_3.2.0(http://www.eclipsetotale.com/tomcatPlugin.html),把com.sysdeo.eclipse.tomcat_3.2.1拷贝到eclipse/dropins下即可,安装完后可以在Eclipse中启动tomcat

4、在eclipse中Window->Preferences->Tomcat配置好Tomcat版本路径和jdk即可。

5、在%catalina_home%/conf/Catalina/localhost下增加应用的xml配置文件,比如应用的名称叫test,则新建一个text.xml,增加项目文件路径
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/Struts2Demo1" docBase="E:\webworkspace\Struts2Demo1\WebContent" debug="0" privileged="true">
</Context>
这样配置不需要发布项目到tomcat下。

6、在Eclipse中修改项目编译文件的输出路径,右键项目名称->properties->Java Build Path->Source下面的Default output folder改成
项目名称/WebContent/WEB-INF/classes,否则默认编译文件的输出路径是
项目名称/build/

7、资源文件的编码记得改成utf-8,用native2ascii转换资源文件为unicode编码的使用记得加上-encoding utf-8选项
native2ascii -encoding utf-8 globalMessages.properties globalMessages_zh_CN.properties
否则界面的国际化信息将是乱码

8、要使用datetimepicker等dojo标签,需要引入dojo标签库
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

9、struts的标签<s:text name="key"/>,只要国际化资源文件中配置了key,直接写key就行了,不需要%{getText('key')},自动国际化了。