首页>代码>springboot+thymeleaf基于jquery.validate批量验证表单实例>/bootstrap-demo1/src/main/java/com/example/demo/TestController.java
package com.example.demo; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.example.entity.Pager; import com.example.entity.Test; /** * 表单批量验证测试demo * @author 程就人生 * @date 2019年9月11日 */ @RestController @RequestMapping("/index") public class TestController { /** * 页面初始化 * @return * */ @GetMapping public ModelAndView index(){ return new ModelAndView("/index"); } /** * 提交操作 * @param test 接收提交的数据 * @return * */ @PostMapping public Object save(@RequestBody Test... tests){ Map<String,String> returnMap = new HashMap<String,String>(); for(Test test : tests){ System.out.println(test.getUserName() + ":" + test.getUserMobile() + ":" + test.getEmail() + ":" + test.getStatus()); } returnMap.put("message", "共提交数据:" +tests.length + "条"); return returnMap; } /** * 列表查询,异步获取数据 * @param pager * @return * */ @GetMapping("/searchByCriteria") public Object searchByCriteria(Pager pager){ List<Test> list = new ArrayList<Test>(); //模拟一条已经存在的数据,也可以模拟多条 Test test = new Test(); test.setUserUid("123456"); test.setUserName("aa"); test.setUserMobile("15994587889"); //0,未删除;1:已删除; test.setIsDelete((byte)0); list.add(test); Map<String,Object> map = new HashMap<String,Object>(); map.put("total", 0); map.put("code", 200); map.put("rows", list); return map; } }

fbbwsd LV1
2020年4月18日
tuyinbo LV2
2020年1月3日
soft5200 LV30
2019年11月17日
admin123456686 LV10
2019年10月29日
cocon2 LV10
2019年10月8日
123123123qqqqq LV2
2019年9月29日
near2434 LV13
2019年9月27日
安阳工学院 LV8
2019年9月23日
啊啊啊13 LV1
2019年9月20日
zhenghongixin4065 LV9
2019年9月19日