Close
« Tutorial

Spring MVC - Redirect Passing Data MCQ

0/13
0 ✓
0 ✗

1. What is the modern and recommended way to pass data to a redirect target in Spring MVC?

2. Which package contains the RedirectAttributes interface?

3. Which method is used to add an attribute to RedirectAttributes?

4. When a redirect URL contains URI template variables, what happens to a RedirectAttributes attribute whose name matches a variable?

5. What happens to a RedirectAttributes attribute that does not match any URI template variable in the redirect URL?

6. In the code below, what does ra.addAttribute("name", "John") do?

public String handle(RedirectAttributes ra) {
  ra.addAttribute("name", "John");
  return "redirect:/greeting";
}

7. After a redirect, how can data added with RedirectAttributes usually be accessed in the target handler?

8. What does setContextRelative(true) do when used with RedirectView?

9. What is the effect of using the redirect: prefix in a return value such as return "redirect:/target";?

10. When a redirect URL has both URI template variables and query parameters, how are RedirectAttributes handled?

11. Which statement about RedirectAttributes is correct?

12. What is a main benefit of using RedirectAttributes instead of adding data directly to a normal Model for a redirect?

Join