Servlet interview questions [ Part 5 ]

1. What are important features of Servlet 3?
Greater pluggability as a result of Web fragments and new methods to add servlets and filters
New annotations: Servlet Annotation, Servlet Filter Annotation and Servlet Context Listener Annotation
Support for asynchronous processing
Security enhancements related to user authentication

2. How to make sure a servlet is loaded at the application startup?

3. In web.xml file   <load­on­startup>1</load­on­startup> is defined between <servlet></servlet> tag what does it means.

4. What is the difference between encodeRedirectUrl and encodeURL?
encodeURL() is used for all URLs in a servlet's output. It helps session ids to be encoded with the URL.
encodeRedirectURL() is used with res.sendRedirect only. It is also used for encoding session ids with URL but only while redirecting.

5. What is URL Encoding?
URL encoding is the practice of translating unprintable characters or characters with special meaning within URLs to a representation that is unambiguous and universally accepted by web browsers and servers. These characters include: ASCII control characters - Unprintable characters typically used for output control.

Related Post