ResponseBody和文件上傳

SpringMVC默認使用MappingJacksonHttpMessageConverter對json數據進行轉換json

<dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.9.0</version>
    </dependency>

 

使用@ResponseBody註解實現將Controller方法返回對象轉換json響應給客戶端。app

 

文件上傳spa

第一種方式:使用commons-fileupload組件實現文件上傳,須要用到commons-fileupload和commons-iocode

第二種方式:xml

相關文章
相關標籤/搜索