首页>代码>java通过nginx+apache tomcat接收用户头像图片上传,实现网站动态和静态域名访问图片的详细教程>/nginxproxy/src/main/java/self/me/web/controller/IndexController.java
package self.me.web.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import self.me.common.utils.PageBean;
import self.me.web.service.UserService;
@Controller
public class IndexController {
@Autowired
private UserService userService;
/**
* 首页
* @return
*/
@RequestMapping("/")
public String index(){
return "index";
}
/**
* 用户列表 public.js 里ajax 触发
* @param pageNum
* @param model
* @return
*/
@RequestMapping("/list")
public String list(Integer pageNum,Model model){
PageBean page=userService.getList(pageNum);
model.addAttribute("page", page);
return "list";
}
/**
* 保存用户 没做数据校验,尽量按合法的来做吧。本工程主要展示上传图片。。
* @param pageNum
* @param model
* @return
*/
@RequestMapping("/save")
public String save(MultipartFile img,String name){
userService.save(img,name);
return "redirect:/";
}
}
最近下载更多
shiopaaa LV13
2021年1月29日
清咿酱 LV11
2020年5月6日
skipple3 LV39
2019年10月15日
qq_1344127185 LV27
2018年9月7日
yangctz LV25
2018年5月28日
106177804liyang LV7
2018年3月12日
boqiu2016 LV17
2017年11月25日
chinafjfzlj LV31
2017年9月8日
190679152@qq.com LV15
2017年2月5日
雷诺阿 LV10
2016年9月13日
最近浏览更多
edpwyg LV14
2024年7月28日
qiangmin1223 LV12
2024年4月24日
wuying8208 LV15
2023年9月4日
tomcat_test LV2
2022年7月6日
xuweisong2010 LV28
2022年5月20日
Zeorwyc LV8
2022年4月27日
yangsha868 LV9
2021年8月13日
on_Angels LV1
2021年7月27日
鑫励诚 LV1
2021年5月10日
Mote-Lwh LV1
2021年3月10日

