Posts

Showing posts with the label @RequestParam

Spring @RequestParam Annotation Example

Image
In this section we will learn about @RequestParam  Annotation.   The  @RequestParam   annotation enables spring to extract input data that may be passed as a query, form data, or any arbitrary custom data. http: //localhost:8080/api/users?name=Sibin&email=sibin@gmail.in If we break the above URL down into smaller parts, then we will see that: HTTP  – is the protocol being used, localhost   – is the domain name, 8080 –  is the port number, api  – is the root path of your web services application, users –  is most likely the @Path value of your Root Resource class and, name  – is the URL Query parameter which we can read with @RequestParam annotation, email – is the URL Query parameter which we can also read with @RequestParam annotation. The following example creates a Spring Boot web application which uses  @RequestParam annotation . Project Directory Pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4