各种参数传递方式
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("test")
public class TestParam {
@RequestMapping("/testParam1.do")
public ModelAndView testParam() {
RedirectView view = new RedirectView("testParam.do");
return new ModelAndView(view);
}
@RequestMapping("/testParam.do")
public String testParam() {
return "error";
return "redirct:testParamX.do";
}
@RequestMapping("/testParam.do")
public ModelAndView testParam(@ModelAttribute("username")String username) {
System.out.println(username);
return new ModelAndView("hello");