mvc returns character settings (null returns "", xxs injection, date conversion, etc.)

1.
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org /schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/ mvc/spring-mvc-3.2.xsd">

indicate the version (all involved must be indicated) otherwise:
cvc-complex-type.2.1: The element 'mvc:annotation-driven' must contain no characters or element information items [children ], because the content type of the type is empty.




2,

com.fasterxml.jackson.databind.ObjectMapper
inherits this class and can filter the characters passed from jsp to java, such as Xss injection, time format, etc.
It can also process Java objects converted to json and return jsp, time format, null character set, etc., that is This is a two-way interception processing mainly for @ResponseBody





<!-- Start annotation-driven Spring MVC function to realize the mapping of foreground data or operation annotations-->
<mvc:annotation-driven>
    <mvc:message-converters register-defaults="true" >
<!--Handle json and other return jsp download problems-->
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <property name="supportedMediaTypes ">
                    <list>
                        <value>text/html;charset=UTF-8</value>
                        <value>text/plain;charset=UTF-8</value>
                        <value>application/json;charset=UTF-8< /value>
                    </list>
                </property>
            </bean>
<!--The processing object is converted into json and returned to jsp, and jsp is injected into the background of Xss-->
            < bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="com.esteel.until.CustomJacksonObjectMapper" />
                </property>
            </bean>
    </mvc:message-converters>
    </mvc:annotation-driven>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326668566&siteId=291194637