Close
« Tutorial

Spring MVC - Binding request/path params to Java Backing Objects MCQ

0/13
0 ✓
0 ✗

1. What is the main purpose of the @RequestParam annotation in Spring MVC?

2. When should you consider using a JavaBean object instead of multiple @RequestParam annotations?

3. What must a Java class follow so that Spring can bind request parameters to its properties?

4. By default, what happens if a request parameter marked with @RequestParam is missing from the request?

5. Which attribute of @RequestParam allows you to make a request parameter optional?

6. What is the effect of supplying a defaultValue on a @RequestParam?

7. Which annotation is used to read a value from a URI template variable (for example, /trades/buy/EUR/USD)?

@RequestMapping("{buySell}/{buyCurrency}/{sellCurrency}")
public String handleRequest(/* add annotation here */ String buySell, ...) { ... }

8. What is the difference between @RequestParam and @PathVariable?

9. Which Spring class is primarily responsible for binding request parameters to handler method arguments?

10. What does WebDataBinder use to convert request parameter string values to the target property types?

11. When you use a JavaBean to capture request parameters, do you need to annotate each bean property with @RequestParam?

12. Is a binding object automatically added to the model before the handler method is called?

13. What happens if you set required = false on a @RequestParam and the parameter is not present in the request?

14. Which statement about the value (or name) attribute of @RequestParam is correct?

15. What is the relationship between WebDataBinder and DataBinder?

Join