1. Void: And does not use SERVLETAPI to jump, the request name will be jumped by default as the name of the attempt.
@RequestMapping ("/login") publicvoid Login (User User) { }
Results:
void: Servletapi is used in the parameter, and jumps are made using Servletapi in the method. Then follow the Servletapi jump position to jump.
@RequestMapping ("/login") publicvoid Login ( HttpServletRequest Req,httpservletresponse resp) { try { Req.getrequestdispatcher ( "success.jsp"). Forward (req, resp); Catch (servletexception e) { e.printstacktrace (); Catch (IOException e) { e.printstacktrace (); } }
Results:
With the SERVLETAPI jump page, it is possible to carry data through SERVLETAPI, but the model data through MVC cannot carry data.
2. Modelandview returns NULL, the page does not jump.
@RequestMapping ("/login") public Modelandview Login () { System. out. println ("login=========="); return NULL ; }
When the return value does not specify a view name, the default is to use the request name as the view name to jump.
@RequestMapping ("/login") public Modelandview Login () { returnnew Modelandview (); }
When the return value specifies the view name, a jump is made according to the specified attempted name.
3. String: If the return value is NULL, then the request name jumps to the view name.
If the return value is specified, then the specified return value is used as the view name to jump, can carry the data through MODEL,MODELMAP, etc.
If the return value is prefixed with "ForWord" or "redired", the request is forwarded and redirected accordingly, and data cannot be carried through the MVC data model, which can be carried by SERVLETAPI.
4. Other types: can only be returned by JSON at asynchronous time.
The return value type of the SPRINGMVC processing method