我正在尝试使用openhift服务部署我的Web应用程序。我在非常类似的jsp上设置了charset编码:<%@ page contentType="text/html;charset=UTF-8" language="java"%>
我在控制器中有:produces = "text/html;charset=UTF-8"
和我的pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<finalName>TrunkSchedule</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--some dependencies-->
</dependencies>
<profiles>
<profile>
<id>openshift</id>
<build>
<finalName>TrunkSchedule</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
本地一切正常,但部署编码时会被破坏。 可能是openshift中的问题?