用ant的native2ascii来自动转换application.resource

Posted by 猪头小队长 | 程序设计 | Wednesday 26 May 2004 21:31

在用eclipse编写struts程序的时候,对存在中文字符资源文件的处理需要native2ascii一下才可以正确显示,可以稍微修改build.xml来自动画完成这个工作。
把"用eclipse构建一个struts开发环境(不用插件) "里的第6步提到的那个build.xml修改一下,添加一条语句(蓝色部分):
<target name="resources">
<native2ascii src="src/java/resources_src" includes="*.properties" dest="src/java/resources" />
<copy todir="classes" includeEmptyDirs="no">
<fileset dir="src/java">
<patternset>
<include name="**/*.conf" />
<include name="**/*.properties" />
<include name="**/*.xml" />
</patternset>
</fileset>
</copy>
</target>

这样,每次修改资源文件后,运行一下这个build.xml,资源文件就被更新了,AppServer不用重起即可生效(不知道哪个Server可以不重起就可以激活struts-config.xml的改动)。

这里,因为src和dest属性要求名字不一样,没有办法,又新建了一个文件夹resources_src,然后把资源文件放到此文件夹下,经过native2ascii之后,转化过的文件被放到resources里面,这样我们只要编辑resources_src里面的东西就OK了。不知道有没有其他的好办法,:)

[@more@]

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word