AppFuse中DisplayTag乱码问题的解决

工作环境:Windows Server2003SE,Eclipse3.1.1,MySQL5.0,Tomcat5.5.9,JDK1.5.0_07,Ant1.6.5
在中文环境下使用AppFuse,会遇到DisplayTag的题头信息乱码现象(最新发布的AppFuse1.9.4也有这个问题),如下图:

解决方法:
1.查看web/web-inf/classes目录下是否存在displaytag_zh_CN.properties配置文件,1.9.1前的版本没有中文版本的配置文件.如果Eclipse中打开看到的是乱码,选择File->Properties 选择UTF-8类型查看,下同。
2.打开项目build.xml文件,找到target copy-resources所在位置(通过字符串copy-resources查找快)
将原来的代码:
    <target name="copy-resources" depends="prepare"
        description="Copy .properties and .xml files from source directory">
        <copy todir="${build.dir}/web/classes" includeEmptyDirs="no">
            <fileset dir="web/WEB-INF/classes">
                <exclude name="ApplicationResources_zh*.properties"/>
                <include name="*.properties"/>
                <include name="*.xml"/>
                <include name="*.vm"/>
            </fileset>
            <filterset refid="variables.to.replace"/>
        </copy>
        <native2ascii src="web/WEB-INF/classes" _fcksavedurl=""web/WEB-INF/classes"" dest="${build.dir}/web/classes"
            includes="ApplicationResources_zh*.properties" encoding="UTF-8"/>
        <generate-database-properties/>
        <copy todir="${build.dir}/web/classes" file="database.properties"/>
    </target>
修改为(添加红色的):
    <target name="copy-resources" depends="prepare"
        description="Copy .properties and .xml files from source directory">
        <copy todir="${build.dir}/web/classes" includeEmptyDirs="no">
            <fileset dir="web/WEB-INF/classes">
                <exclude name="ApplicationResources_zh*.properties"/>
                <exclude name="displaytag_zh*.properties"/>               
                <include name="*.properties"/>
                <include name="*.xml"/>
                <include name="*.vm"/>
            </fileset>
            <filterset refid="variables.to.replace"/>
        </copy>
        <native2ascii src="web/WEB-INF/classes" dest="${build.dir}/web/classes"
            includes="ApplicationResources_zh*.properties" encoding="UTF-8"/>
        <native2ascii src="web/WEB-INF/classes" dest="${build.dir}/web/classes"
                includes="displaytag_zh*.properties" encoding="UTF-8"/>       
        <generate-database-properties/>
        <copy todir="${build.dir}/web/classes" file="database.properties"/>
    </target>
通过native2ascii将displaytag_zh_CN.properties配置文件同ApplicationResources_zh*.properties一样转换下,就OK了。奇怪 Matt Raible在最近AppFuse1.9.4中都没改过来:)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值