DD elements <context-param> and <init-param> both can be retrieved by the getInitParameter() method, in the servlet code.
Now the question is, how does it differentiate <context-param> and <init-param>?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Servlet init parameters are for a single servlet only. Nothing outside that servlet can access that. It is declared inside the
<servlet>tag of Deployment Descriptor, on the other hand context init parameter is for the entire web application. Any servlet or JSP in that web application can access context init parameter. Context parameters are declared in a tag<context-param>directly inside the<web-app>tag.The methods for accessing context init parameter is
whereas the method for accessing servlet init parameter is