Close
« Tutorial

Spring MVC - POST Request With Simple Form Submission MCQ

0/13
0 ✓
0 ✗

1. Which HTML form attribute tells the browser to send the form data using an HTTP POST request?

2. What does the action attribute of an HTML form specify?

3. What is the default HTTP method used by an HTML form if the method attribute is not given?

4. How does a simple HTML form send its field values in a POST request?

5. Why is POST usually a better choice than GET for submitting form data?

6. Which annotation is a shortcut for mapping a controller method to HTTP POST requests?

7. Which annotation is used to bind a submitted form field to a controller method parameter?

8. How does Spring match a form field to a method parameter annotated with @RequestParam?

9. By default, what happens if a required @RequestParam value is missing from the request?

10. A controller class is annotated as shown below. For which URL and HTTP method does the create() method handle requests?

@Controller
@RequestMapping("/orders")
public class OrderController {

  @PostMapping
  @ResponseBody
  public String create() {
    return "ok";
  }
}

11. What is the purpose of the @ResponseBody annotation on a controller method?

12. What is the role of the DispatcherServlet when a form is submitted to a Spring MVC application?

13. Which method of WebMvcConfigurer is used to serve static files, such as HTML pages, from a folder in the web application?

14. Which annotation is used on a Java configuration class to enable Spring MVC features?

15. When testing from the command line, what does the -d option of curl do?

Join