java - Spring mvc 使用mvn jetty:run启动 页面上的中文乱码,Tomcat就没问题
阿神
阿神 2017-04-18 10:52:22
0
1
516
    使用jetty的maven插件(9.x的版本也是一样)
    <plugins>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.16.v20140903</version>
      </plugin>
    </plugins>
    
    JSP上的原有的中文都能正常显示,但是通过model传递过来的中文都是乱码
    然后使用Tomcat是正常的
    
    这个jetty是插件,好像也没地方改编码    
    
阿神
阿神

闭关修行中......

reply all(1)
黄舟

I solved it myself, specify the encoding through the plug-in when compiling with Maven

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
      <encoding>utf8</encoding>
    </configuration>
  </plugin>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!