1. Jump, redirect
It is necessary to jump and redirect in any Web project, and in the servlet, the way to jump (1) can be response.sendredirect via the client ("Jsppath") but the jump can only pass the properties of the session range. The request scope property cannot be passed, (2) execution of a service-side jump (the address bar does not change) must rely on the RequestDispatcher interface to complete, need to pass the forward (backstage) or include (page) to complete the jump .
In Springmvc, the action in the controller is my own use of two return values Modelandview and string. Modelandview is a class of presentation objects and views in the SPRINGMVC package (noted in the note: Represents a model and view returned by a handler, to is resolved by a Dispa Tcherservlet.)
1.1, Modelandview
When returning Modelandview, use Setviewname (String viewName) to set up a JSP page to display the binding.
If in the process, according to the business logic processing needs to jump to other actions, but also call Setviewname (String viewName), but this time the viewName is a format required to start with "redirect:", such as: " Redirect:/list ".
1.2, String
Returns a string that is directly returned. More often, this situation returns the JSON string. In this case, the jump is done by returning a string similar to "Redirect:/list".
1.3. Parameters in the jump process
A) can be directly in the address stitching, but pay attention to the situation of Chinese garbled
b) There is a more elegant way to set the jump parameters through Redirectattributes.
Reference:
http://zghbwjl.blog.163.com/blog/static/12033667220137795252845/
http://blog.csdn.net/liushengmeng/article/details/7985080
2. Front and back-end interaction
In addition to providing users with the required data, the web also needs to meet the user's operational needs and the data that the user wants the server to provide. The objects that can be passed in servlet and JSP (application,session,request, page) are the most commonly used session and request. The JSP sends operations and data to the servlet primarily through form forms and URL address parameters (the main way is Post,get).
In Springmvc, the action directly addobject (String AttributeName, Object AttributeValue) The way the data is passed through the data in the JSP (the JSP can get the data through the EL expression) ,
http://blog.csdn.net/seawaywjd/article/details/7335804
SPRINGMVC Study Notes