The attribute appears as string name-value pairs in the URL because the @ModelAttribute annotation is used in the controller.


, 2.

Adding "model.asMap().clear();" will prevent the attribute name-value pair from appearing in the URL.


, 3.

The attribute name-value pair will be included in the URL, regardless of the use of @ModelAttribute in the controller.


, 4.

The attribute name-value pair cannot be excluded from being displayed in the URL.


">
MCQs > IT & Programming > Spring MVC >

Given the method below:

@RequestMapping(value = "/foo", method = RequestMethod.GET)

public final String foo(HttpServletRequest request, BindingResult bindResult, ModelMap model) {

    model.addAttribute("abc", 123);

    return "foo";

}

When the view is displayed in the browser, it's URL is "http://mydomain/foo?abc=123".

Which of the following statements is true?

Spring MVC MCQs

Given the method below:

@RequestMapping(value = "/foo", method = RequestMethod.GET)

public final String foo(HttpServletRequest request, BindingResult bindResult, ModelMap model) {

    model.addAttribute("abc", 123);

    return "foo";

}

When the view is displayed in the browser, it's URL is "http://mydomain/foo?abc=123".

Which of the following statements is true?

Answer

Correct Answer:

The attribute name-value pair will be included in the URL, regardless of the use of @ModelAttribute in the controller.


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Spring MVC Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Spring MVC Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it