問題が発生します:
@responsebody経由で返品します
@ResponseBody@requestMapping(value = "/selectbyformid"、method = requestmethod.get)public map <string、object> getclassname(string formid){list <string> list = forminfoservice.selectclassname(formid); map <string、object> map = new hashmap <string、object>(); map.put( "data"、list); map.put( "status"、true);マップを返す;}結果:
{"data":["bixuan crazy silhouette"、 "qi ling"、 "silhouette"、 "silhouette"、 "bi hair shape"、 "bi髪の形"、 "chen huan lan shape"、<br> "silhouette"、 "han hong lan shape"、 "han honut解決:
spring-mvc.xmlで構成します
<! - 応答ボディの文字化けの問題を解決します。 stringhttpmessageconverter。親クラスAbstttpMessageConverterのコンバーターをコンバーターに変換する場合、親クラスAbstracthttpmessageConverter ISO-8895-1のサポートメディアタイプのプロパティはデフォルトでは、 - > <MVC:Annotation-Driven> <MVC:MVC-Converters> <Bean> <Bean> <BEAN> <BEAN> <BEAN> <BEAN> <BEAN> <BEAN> <BEAN> <BEAN> <BEAN value = "text/html; charset = utf-8"> </property> </bean> </mvc:message-converters> </mvc:annotation-driven>
しかし、構成の後、新しい問題があります
エラー:... CVC-Complex-Type.2.1:要素 'MVC:Annotation-driven'は、タイプのコンテンツタイプが空であるため、文字または要素情報項目[子]を含める必要があります。
後で、SpringMVCのXSDファイルバージョンが間違っていることがわかりましたので、SpringMVC 4.0 XSDに変更することができます
<beans xmlns = "http://www.springframework.org/schema/beans" xmlns:xsi = "http://www.w3.org/2001/xmlschema-instance" xmlns:p = " xmlns:Context = "http://www.springframework.org/schema/context" xmlns:mvc = "http://www.springframework.org/schema/mvc" xsi:schemalocation = " http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context-/spring-context-/spring-contex http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd ">
それから大丈夫です
{"data":["情報リクエスト"、「プロモーション "、「管理」、「一時的支店」、「保管と輸送」、「資産」、「情報サービス」、「旅行管理」、「旅行管理」、「人員出席」、「<br>、「財務」、「顧客」、「顧客」、「訪問提案」、「顧客の苦情」、「顧客の苦情」、「人事活動」、「姿勢」、「操作」、「職業管理」、「支払い」、「主な文書」、「主な文書」、「主な文書」、「操作」stringhttpmessageconverterこの方法には多くの変換機能があるため、時間があればそれを見ることができます。
上記の記事Spring+MyBatisのソリューションは、 @ResponseBodyを介して結果を返すことです。エディターが共有するコンテンツ全体です。私はそれがあなたに参照を与えることができることを願っています、そして私はあなたがwulin.comをもっとサポートすることを願っています。