package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
@Controller
public class UserController {
@RequestMapping(value = "/quick")
public String save(){
System.out.println("UserController.save");
return "/index.jsp";
}
@RequestMapping(value = "/quick2")
@ResponseBody
public void save2(String name ,MultipartFile uploadFile) throws IOException {
System.out.println(name);
String originalFilename = uploadFile.getOriginalFilename();
uploadFile.transferTo(new File("D:\\test\\"+originalFilename));
}
@RequestMapping(value="/quick3")
@ResponseBody
public void save3(String name,MultipartFile[] uploadFile) throws IOException {
for(MultipartFile multipartFile:uploadFile){
String originalFilename = multipartFile.getOriginalFilename();
multipartFile.transferTo(new File("D:\\test\\"+originalFilename));
}
}
@RequestMapping(value="/quick4")
@ResponseBody
public void save4(){
String str="qweqe";
int number=Integer.parseInt(str);
}
@RequestMapping(value="/quick5")
@ResponseBody
public void save5(){
String str=null;
str.toLowerCase();
}
}
|
|