Home >Java >javaTutorial >Recommended articles about @PathVariable
In series (4) we introduced how to use @RequestParam to bind data. Let's take a look at how to use other data binding annotations. 1.@PathVariable is used to bind URL template variable values. We have already introduced how to use this in series (3) and will not go into details here. 2.@CookieValue is used to bind data in Cookie. Next we use the sessionId in the cookie to do the test: add cookiebind action in DataBindController, the code is as follows: //@CookieValue Test@RequestMapping(value="/cookiebind", method = {RequestMethod.GET})public String cookieBind(HttpServletRequest request, &
1. SpringMVC Learning Series (5) Data Binding-2
##Introduction: In series (4) we introduced how to use @RequestParam to bind data. Let’s take a look at how to use other data binding annotations 1. @PathVariable is used to bind. Determine the URL template variable value. We have already introduced the method of use in series (3), so we will not go into details here. 2. @CookieValue is used to bind the data in the cookie. Next, we use the sessionId in the cookie for testing: in DataBindContro.
2. SpringMVC Learning Series (4) Data Binding-1
Introduction: In series (3) we introduced how a request is mapped to an action. The next step is of course how to obtain the data in the request, which leads to what this article will talk about. Content - data binding. First, let’s take a look at the annotations for binding data: 1. @RequestParam, which binds a single request data, which can be the data in the URL, the data submitted by the form or the uploaded file; 2. @PathVariable , bind URL template variable value; 3. @CookieValue, bind cookie number
3. @RequestParam @RequestBody @PathVariable and other parameter binding annotations detailed explanation
Introduction: Introduction: Handler method parameter binding commonly used annotations, we divide them according to the different contents of the Request they handle. There are four categories: (mainly explaining common types) A. Annotations for processing the request uri part (here refers to the variable in the uri template, excluding the queryString part): @PathVariable; B. Annotations for processing the request header part: @RequestHeader
[Related Q&A recommendations]:
java - I would like to ask, can a default value be specified when @PathVariable is empty?
The above is the detailed content of Recommended articles about @PathVariable. For more information, please follow other related articles on the PHP Chinese website!