java-json 数据前台显示为问号解决

很多时候json数据传输在前台显示的时会显示问号考虑一下两个问题:

 1.  web.xml.检查是否进行过滤

 <!-- Spring提供的字符编码过滤 -->

   <filter>

      <filter-name>encodingFilter</filter-name>

      <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

      <init-param>

          <param-name>encoding</param-name>

          <param-value>UTF-8</param-value>

      </init-param>

      <init-param>

          <param-name>forceEncoding</param-name>

          <param-value>true</param-value>

      </init-param>

   </filter>

   <filter-mapping>

      <filter-name>encodingFilter</filter-name>

      <url-pattern>/*</url-pattern>

</filter-mapping>

 

2.检查发现,已经配置了,但是还是问号,(急死了!

springMVC中的注解里加一句话:

 

produces = "text/html;charset=UTF-8"

你可能感兴趣的:(java-json 数据前台显示为问号解决)