• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

SpringMVC中返回模型视图和字符串的区别


Recommended Posts

1、返回模型视图

@RequestMapping(value='/test ',method=RequestMethod .获取)

公共对象测试(HttpSession会话){

modeland view MAV=new modeland view();

小牛。设置视图名(' test ');

回归顺丁烯二酐值

}

解释:返回对象会访问jsp文件,比如如上的例子会访问学习笔记一中视图解析器的前缀试验后缀这个jsp文件,就像/WEB-INF/jsp/test.jsp .这样写默认是重定向操作,如果要进行请求转发,只需小牛。设置视图名(“forward : test”)。

1、退货字符串

@RequestMapping(value='/test ',method=RequestMethod .获取)

公共字符串测试(HttpSession会话){

返回”转发:/测试/测试2”;//如果是重定向返回”重定向:/测试/测试2”;

}

解释:返回字符串的字符串一般是uri,最后还是通过请求映射找到对应的视图模型。

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now