[MUSIC] Typically, we don't just have data, on the server side. We're more building a cloud service for mobile devices. We typically, are building applications where we have some data that's living on the devices, and some data that's living in the server's side. And there's a constant flow of information between the two. So, important question is, how do we take data, from the mobile device, send it to the server and using a spring controller, extract that data from the request, just like we could with servlet. With servlets we could. We read, request parameters out of the HTTP request object. So how do we do the same the same thing, with the spring control? Well, the way that we do this, is first, let's say we're going to have a contacts control object and it's as we discussed before it's where all the contacts for a user. But let's say, we want to allow users, to send a search string. They want to find a specific contact or contacts that start with a or c. How do they do that? Well, let's create a method. Let's say, we have a method called, search and. Search is going to take some parameters, which I'm going to, fill out on the next line here, but I'm going to just leave some space here where I'll fill these parameters out. And then within our method, we actually do some work. So, let's say for example, we wanted to have a string. Which is the, search string. And then maybe we want to have, an integer, which is a search flag, which is a search flag, which tells us, how we want it to match. Do we want to match against. The first name or the last name. Or, maybe we want it to indicate, how strict it should be in the match. So, how would we go about, telling the dispatcher servlet, how to map, the http request parameters, to these individual, method parameters, for this method within our controller. Or the way that we do that, is first of course, we going to have to add an at request mapping annotation, to this method so that the dispatcher servlet, knows the column. So we will just put at under slash search. So whenever we see slash search, in our requests, the dispatcher servlet is going to route it to the search method. No we need a way of telling the dispatcher servlet, about these method parameters and how we want it to fill them in. And then we, way, we do that, is with at-request param. And these are params or annotations, that can be attached, to, individual. Method parameters. So for example, at request params search, but then say go and extract the HTB request parameter, with the key search and map it to this, individual method parameter. Similarly we could say, at request param. Flag and the dispatcher server will automatically go and look for an HTTP request parameter, with the key flag and map to search flag. Now one of the really important things to notice here. Is what the dispatcher server is going to do for us in this case. The request for param flag, in the HT request, is going to be stored as a string. So what that means is, is when the dispatcher server extracts that string, it has to convert it to an integer. In order to pass it into this method force. So the dispatcher server, when you map request parameters to method parameters it automatically figures out what the correct target type of that parameter is in Java. And it will do the conversion for you. So the dispatcher server will automatically go. And look and say, all right. Flag is being mapped to an integer so I need to convert flag to an int before I invoke the search method with this data from this request. And what's important to note, is all of the validation of the type, from that request parameter string is being done by the dispatcher servlet for you, automatically. And then it's automatically marshalling all of that data after extracting it, into your method parameters. So then your method, you can write standard Java code and logic code that's just OO code without having to muck around with the request and the extracting data from the requesting and converting it to the right types. In handling any errors that occur. The dispatcher server does that automatically for you, and that allows you to separate that logic out from your code, which really isn't what your business logic in this method is supposed to be doing anyway. So your cloud service wants to calculate something, it wants to do something. It doesn't want to be worried with how that request got to the server, what format it got there in, how all the data got extracted from it. It just wants to, do some calculations on it. So this allows you to simplify your methods and write cleaner, simpler methods, by using request parameters in the request mapping to extract that data and pass it into your method.