@Controller
@RequestMapping(value={"/hello"})
public class HelloController {
@RequestMapping(value={"sub"})
public ModelAndView submit(HttpServletRequest request) throws Exception {
// TODO Auto-generated method stub
ModelAndView m=new ModelAndView();
m.addObject("ok", "hello");
m.setViewName("success");
return m;
}
}
@Controller
@RequestMapping(value={"/user"})
public class UserController {
@RequestMapping(value={"/get"})
public ModelAndView user(User user) throws Exception {
ModelAndView mv=new ModelAndView();
mv.addObject("ok",user.getUsername()+"--"+user.getPassword());
mv.setViewName("success");
return mv;
}
}
<form action="user/get" method="post">
<input type="text" name="username" id="username">
<input type="text" name="password" id="password">
<input type="submit">
</form>
@RequestMapping(value={"/map"})
public String ok(Map map,Model model,ModelMap modelmap,User user) throws Exception {
map.put("ok1", user);
model.addAttribute("ok2",user);
modelmap.addAttribute("ok3", user);
return "show";
}
@RequestMapping(value={"ant/{username}/topic/{topic}"},method={RequestMethod.GET})
public ModelAndView ant(
@PathVariable(value="username") String username,
@PathVariable(value="topic") String topic
) throws Exception {
// TODO Auto-generated method stub
ModelAndView m=new ModelAndView();
System.out.println(username);
System.out.println(topic);
return m;
}
@RequestMapping(value={"/regex/{number:\\d+}-{tel:\\d+}"})
public ModelAndView regex(
@PathVariable(value="number") int number,
@PathVariable(value="tel") String tel
) throws Exception {
// TODO Auto-generated method stub
ModelAndView m=new ModelAndView();
System.out.println(number);
System.out.println(tel);
return m;
}
@RequestMapping(value={"/ok1"})
public String ok1(@RequestParam(value="username") String username) throws Exception {
System.out.println(username);
return "show";
}
@RequestMapping(value={"/ok2"})
public String ok2(@RequestParam String password,@RequestParam String username) throws Exception {
System.out.println(username);
System.out.println(password);
return "show";
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有