java - difference betweern return plain modelandview and return a redirect modelandview -


I just learned Spring MVC webflow I'm confused with this:

  New Models And return ("test"); Return a new model and view ("Redirect: Test");   

Is there a redirect like one, such as response.sendRedirect () ? And I just check the spring reference, in fact, returns the new redirect view () in the same way as response.sendRedirect () . So what's the difference between these three

If you compare ModelAndView ("Test") and ModelAndView "Redirect: Test") The first request for the sublett framework will be similar to the RequestDispatcher and will be similar to request.sendRedirect () if you want to know the difference between requestdispatcher and sendredirect, the answer is < P> Even if the "Redirect: test" is to call the HTTPSpreadSaver capacitance (Redirector), redirect view ob Ject gives you convenience and a little more functionality.
Using the Serbate API directly into the IMO framework, it is probably not a good idea, except you want to hack some stuff or workaround something.

RedirectView releases an HttpServletResponse.sendRedirect () call that returns the client browser as an HTTP redirect. By default, all model attributes are highlighted in the redirect URL as the URI Template Variable. Of the remaining features which are primitive types or primitive types of collections / arrays, they are automatically added as query parameters. Anyway, in spring MVC, there is usually more than one kind of use to do the same thing; it's a matter of coding style, for example,

  public string doSomething (model model) {return "test"; } Public models and views i_am_similar_to_do some () new models and see (see "test"); } // You can guess that you can do the same thing with redirects.   

There are a few other ways to do this, but I suggest trying to stick to the same style for the whole app.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -