由于我们的想使用的是maven编译,所以在国际化的时候,我们需要将我们的properties文件放到我们的resoures下面,就需要在pom文件中配置buid的时候配置
<build>
<finalName>pa</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>native2ascii</goal>
</goals>
<!-- specific configurations -->
[b]<configuration>
<encoding>utf-8</encoding>
<src>src/main/resources/</src>
<ext>.properties</ext>
<includes>*.properties</includes>
<dest>target/classes/</dest>
</configuration>[/b]
</execution>
</executions>
</plugin>
</plugins>
</build>
这样我们在转码的时候会转成utf-8
当然也需要在我们的web.xml中配置resourseServlet指定resourse位置
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<build>
<finalName>pa</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>native2ascii</goal>
</goals>
<!-- specific configurations -->
[b]<configuration>
<encoding>utf-8</encoding>
<src>src/main/resources/</src>
<ext>.properties</ext>
<includes>*.properties</includes>
<dest>target/classes/</dest>
</configuration>[/b]
</execution>
</executions>
</plugin>
</plugins>
</build>
这样我们在转码的时候会转成utf-8
当然也需要在我们的web.xml中配置resourseServlet指定resourse位置
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>