Spring Questions and Answers – Spring Portlet MVC

This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Spring Portlet MVC”.

1. DispatcherServtlet dispatches portlet requests to appropriate handlers that handle the requests.
a) True
b) False
View Answer

Answer: b
Explanation: DispatcherPortlet. It dispatches portlet requests to appropriate handlers that handle the requests. It acts as the front controller of Spring Portlet MVC, and every portlet request must go through it so that it can manage the entire request-handling process.

2. Maps each request to a handler through one or more handler mapping beans.
a) DispatcherServlet
b) DispatcherPortlet
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: b
Explanation: Once it has picked an appropriate handler, it will invoke this handler to handle the request.

3. In portlets, there are URLs:-
a) render
b) action
c) all of the mentioned
d) none of the mentioned
View Answer

Answer: c
Explanation: In portlets, there are two types of URLs: render URLs and action URLs.
advertisement
advertisement

4. When a user triggers a render URL, the portlet container will ask all the portlets in the same page to handle a render request to render its view.
a) True
b) False
View Answer

Answer: a
Explanation: When a user triggers a render URL, the portlet container will ask all the portlets in the same page to handle a render request to render its view, unless the view’s content has been cached.

5. When a user triggers an action URL in a portlet, the portlet container will first ask the target portlet to handle an action request.
a) True
b) False
View Answer

Answer: a
Explanation: A controller should return an object in response to a render request. However, when a user triggers an action URL in a portlet, the portlet container will first ask the target portlet to handle an action request. A controller needn’t return anything for an action request.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. After Controller has finished handling a render request, it returns:-
a) model name
b) view name
c) view obect
d) all of the mentioned
View Answer

Answer: d
Explanation: After a controller has finished handling a render request, it returns a model and a view name, or sometimes a view object, to DispatcherPortlet.

7. DispatcherPortlet resolves a view name from one or more view resolver beans.
a) True
b) False
View Answer

Answer: a
Explanation: DispatcherPortlet renders the view and passes in the model returned by the controller. Note that an action request doesn’t need to render a view.
advertisement

8. portlet deployment descriptor file is:-
a) portlet.xml
b) portlet.config
c) portlet.xhtml
d) none of the mentioned
View Answer

Answer: a
Explanation: The Java Portlet specification defines the valid structure of a portlet application, which is very similar to that of a web application, but with the addition of a portlet deployment descriptor (i.e., portlet.xml).

9. Servlet Listener to load the root application context at startup.
a) ContextLoader
b) ContextLoaderListener
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: b
Explanation: In the web deployment descriptor (i.e., web.xml), you have to register the servlet listener ContextLoaderListener to load the root application context at startup.
advertisement

10. Unlike in a web application, you can’t control URLs directly in a portlet.
a) True
b) False
View Answer

Answer: a
Explanation: In the web deployment descriptor (i.e., web.xml), you have to register the servlet listener ContextLoaderListener to load the root application context at startup.

11. You can chain multiple handler mapping annotations as required to portlet.
a) True
b) False
View Answer

Answer: a
Explanation: Spring Portlet MVC comes with several strategies for you to map portlet requests.

12. The preceding controller handles portlet requests:-
a) render requests
b) action requests
c) all of the mentioned
d) none of the mentioned
View Answer

Answer: c
Explanation: The preceding controller handles two types of portlet requests: render requests and action requests.

13. When handling a render request, it gets the time zone attribute from the portlet preference.
a) True
b) False
View Answer

Answer: a
Explanation: When handling a render request, it gets the time zone attribute from the portlet preferences and passes it to the view for editing.

14. When handling an action request, it gets the time zone parameter from the portlet request.
a) True
b) False
View Answer

Answer: a
Explanation: When handling an action request, it gets the time zone parameter from the portlet request and stores it in the portlet preferences as an attribute, which will override the existing one.

15. The submission URL of this form should be a portlet action URL that will trigger an action request to the current portlet.
a) True
b) False
View Answer

Answer: a
Explanation: In portlets, you have to construct an action URL with the portlet:actionURL tag defined in the portlet tag library.

Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.