SPRING WEB MVC
Question
A B C D
What is a DispatcherServlet? Used for Dependency Handles all the HTTP requests Used for transaction
Used for Spring AOP.
Injection. and responses. management.
Controller in Spring is .. .
a abstract class concrete class final class an interface
--- is required to load the beans
configured in ContextLoader ContextLoaderListener ApplicationContextLoader
applicationContext.xml file?
Where do you cannot declare In a Spring application
Into the web.xml file of the web Into the java code by using
Spring MVC controller? (multiple context XML configuration Into the JSP pages
application annotations
choise) file
Which of the following layers the
@Controller annotation is used in? Business layer. Presentation layer. Service layer. Persistence layer.
Design pattern implemented by
Dispatcher Servlet. tiles front controller none of the mentioned
jsp
Class used to give a class behavior
of a Dispatcher Servlet. AbstractController Controller Abstract Class AbstractAction
Annotation for Controller class?
@Before @Controller @After @Servlet
What is @Controller annotation? The @Controller annotation The @Controller
The @Controller annotation The @Controller annotation
indicates that a particular annotation indicates
indicates how to control the indicates how to control the
class serves the role of a how to control the
transaction management. dependency injection.
controller. aspect programming.
What does @Required annotation This annotation indicates that This annotation indicates that This annotation simply This annotation
mean? bean property must be bean property is required while indicates that the affected indicates that bean
populated by the user. saving the bean data to bean property must be property is required
database. populated at configuration while serializing the
time, through an explicit
property value in a bean
bean.
definition or through
autowiring.
Where do you define
DispatcherServlet? In Beans configuration file web.xml file META-INF/dispatcher.xml WEB-INF/dispatcher.xml
Which are the modules of Web WebSocket, Servlet, Web, WebSocket, Servlet, Web-MVC, HTML, Servlet, WEB,
layer? HTML, JSP, WEB, Portlet
Portlet Web Portlet
What is Spring MVC framework? The Spring web MVC framework
Spring MVC framework is provides model-view-controller Spring MVC framework is
Spring MVC framework
Model-Value-Class architecture and ready used for Transaction
is used for AOP for Web
architecture and used to bind components that can be used to management for Web
Applications.
model data with values. develop flexible and loosely Applications.
coupled web applications.
What is This event is published when This event is published when This event is published
This event is published when the
RequestHandledEvent:event? the Servlet Context is either the HTTP session is when the HTTP Request
HTTP Request is received.
initialized or refreshed. initialized or refreshed. is serviced.
@RequestMapping annotation is
used to map a HTTP request
method (GET or POST) to a
FALSE TRUE
specific class or method in the
controller which will handle the
respective request?
What annotation is used to map
value to the method argument in @Map @Param @RequestParam @PathVariable
http://localhost/factorial/{value}?
In Spring Web App, which of the
@RestController DispatcherServlet Models Views
following acts as a Front Controller?
What annotation is used to map a
method for PUT request? @PutMapping @PostMapping @Put @Post
Callback methods provided by
HandlerInterceptor to implement. preHandle() postHandle() afterCompletion() All of the mentioned
Handler method annotation.
@Before @Controller @After @RequestMapping
Annotation which represents cookie HttpServletRequest or
values of requests. @RequestParam @Cookie None of the mentioned
HttpServleResponse
To add attributes to the model.
Map ModelMap All of the mentioned None of the mentioned
To notify its completion of session
processing. Errors BindingResult SessionStatus one of the mentioned
Controller Class renders the objects
passed by the controller’s handler TRUE FALSE
method.
Parameter used to specify a
configuration file. contextConfigLocation contextConfigure contextLocation None of these
Bean classes pre-registered in the DefaultAnnotationHandlerMa AnnotationMethodHandlerAdapt
web application context by default. All of the mentioned None of the mentioned
pping er
Method arguments that can be
HttpServletRequest or
used in handler methods using the @RequestParam @ModelAttribute All of the mentioned
HttpServleResponse
@RequestMapping annotation.
Which is not a proper way to Extending Inversion of Control with a
access Hibernate using Spring? HibernateDaoSupport and HibernateTemplate and All of the mentioned None of the mentioned
applying an AOP Interceptor Callback.
Which component is used to map a
request to a method of a controller? RequestMapping RequestMapper URLMapper RequestResolver
What could not return a Spring
MVC controller? An absolute path to the view A logical view name A new JstlView void
___object is used by a request
processing method to check ValidationErrors BindingResult ValidationBinding
validation failure?
Which annotation is required to
receive a model object initialized by
@RequestParam @ModelAttribute @ModelObject
the request parameters, in a
request processing method?
By default, @RequestMapping gets
all the POST Requests. TRUE FALSE
The @RequestMapping annotation
can be applied to the class level TRUE FALSE
only.
To access the binding and
validation result for the command Errors BindingResult All of the mentioned None of the mentioned
object.