Prev Next

Spring / Spring MVC Interview questions

What is ModelAndView in Spring MVC Framework?

ModelAndView is an object that holds both the model and view. The handler returns the ModelAndView object and DispatcherServlet resolves the view using View Resolvers and View.

The View is an object which contains view name in the form of the String and model is a map to add multiple objects.

In the below example 'employeeDetails' is the view name.

ModelAndView model = new ModelAndView("employeeDetails");
model.addObject("employeeObj", new EmployeeBean(123));
model.addObject("msg", "Employee information.");
return model;


Programming Tip : Get an instant remote access to your essential programming/testing work from anywhere on any device(PC/Mac/Linux/android/iOS) by accessing your programming tools online with high performance hosted citrix xendesktop with an affordable xendesktop pricing. Learn more about Hosted SharePoint, QuickBooks Cloud Hosting and Office 365 suite Enterprise E3 by visiting Apps4Rent.com.


It's right time to invest in Cryptocurrencies Dogecoin! Earn free bitcoins up to $250 now by signing up.

Earn bitcoins upto $250 (free), invest in other Cryptocurrencies when you signup with blockfi. Use the referral link: Signup now and earn!

Using BlockFi, don't just buy crypto - start earning on it. Open an interest account with up to 8.6% APY, trade currencies, or borrow money without selling your assets.


Join CoinBase! We'll both receive $10 in free Bitcoin when they buy or sell their first $100 on Coinbase! Available in India also. Use the referral Join coinbase!


Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.


Webull! Receive free stock by signing up using the link: Webull signup.

More Related questions...

What is Spring MVC framework? Advantages of Spring MVC framework over other MVC framework. Explain the request flow and its lifecycle in Spring MVC. What is DispatcherServlet in Spring MVC Framework? Spring MVC Framework: What is ContextLoaderListener? What is the difference between ApplicationContext and WebApplicationContext in Spring MVC? Can we have multiple Spring configuration files in Spring MVC? What are the Spring MVC Annotations? What is a Controller in Spring MVC framework? What is the default scope of Spring MVC controllers? Sping MVC - pass model between controllers. Difference Between @RequestParam and @PathVariable in Spring MVC. Explain Interceptors in Spring MVC framework. What is view Resolver pattern and how does it work in Spring MVC? Advantages of Spring MVC over Struts. What is ModelAndView in Spring MVC Framework? What are the different Controller implementations in Spring MVC framework? What is a MultipartResolver in Spring MVC framework? How do I handle exceptions in Spring MVC Framework? How do I handle views in Spring MVC using XML? How to create Controller in Spring MVC? Spring MVC: How to access values from Model in JSP? How to configure DispatcherServlet without web.xml in Spring MVC? What is the role of @EnableWebMvc in Spring MVC? How do I create a Spring MVC controller without a view? How do I return a string from the Spring MVC controller without a view? Explain @ResponseBody annotation in Spring MVC. Explain @RequestBody annotation in Spring MVC. How do I quickly resolve MVC RequestMapping calling wrong controller method? What does request.getParameter return when the parameter does not exist in Spring MVC/Servlet? RestTemplate: How do you resolve SSLHandShakeException? How do I map the JSON field name to a different Java class property name? How do I configure JNDI DataSource in Spring Web Application? How to implement localization in Spring MVC applications? How does Spring MVC provide validation support? Explain MultipartResolver in Spring framework? What is the front controller class of Spring MVC? Explain Spring MVC Interceptor. Advantage of using HandlerInterceptorAdapter in Spring MVC framework. How to start Spring MVC using spring boot? How do I configure DispatcherServlet without using web.xml in Spring MVC? How do I configure Spring MVC view in @Configuration class without spring XML? Is transaction managed at DAO or Service layer in Spring? Difference between Spring MVC and Spring Web Flow. Use of BindingResult interface in Spring MVC. What is resource-ref in web.xml used for? How JNDI lookup differs between Tomcat and weblogic server? How to enable browser caching of static resources (JS, CSS) with Spring MVC? Why Java web apps has dot(.) do extensions? What is @RequestMapping annotation in Spring MVC? How do I configure Spring MVC to eliminate Path-Based Vulnerability? Difference between Spring Web MVC and Spring WebFlux. What is HTTP multipart request? What is content negotiation in Spring MVC? Difference between RequestMapping and GetMapping in Spring MVC/Spring Boot.
Show more question and Answers...

Spring Data Access

Comments & Discussions