Init param

Init param

What is the correct syntax of init param?

View Answers

March 20, 2008 at 10:03 PM

Hello,

Init parameters are added between the <init-param></init-param> tags under the <servlet></servlet> tags in the web.xml file.

For Example:

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>roseindia.ReadInitParametersServlet</servlet-class>
<display-name>Read Initialization Parameters of the Servlet</display-name>
<init-param>
<param-name>emailHost</param-name>
<param-value>151.68.167.201</param-value>
</init-param>
<init-param>
<param-name>webMaster</param-name>
<param-value>Savitha Rajeev</param-value>
</init-param>
</servlet>

And then use the following code in servlet to read the parameter values.

public void init(ServletConfig config) throws ServletException {
String emailHost = config.getInitParameter("emailHost");
String webMaster = config.getInitParameter("webMaster");
}

or

public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String host = getServletConfig().getInitParameter("emailHost");
String master = getServletConfig().getInitParameter("webMaster");
}

Yes you must restart the application in the production environment.

If you server supports the reload of application then not required to restart the application server.

For example you can use tomcat manager to restart the application.


Thanks









Related Tutorials/Questions & Answers:
Init param - Java Beginners
Init param  What is the correct syntax of init param?  ...-name> <init-param> <param-name>emailHost</param-name> <param-value>151.68.167.201</param-value> </init
ModuleNotFoundError: No module named 'param'
ModuleNotFoundError: No module named 'param'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'param' How to remove the ModuleNotFoundError: No module named 'param'
Advertisements
Init Parameter
Init Parameter  How set Init Parameter in servlet
init method
init method  why init method used in servlet?   The init() method is called only once by the servlet container throughout the life of a servlet. By this init() method the servlet get to know that it has been placed
ModuleNotFoundError: No module named 'param-handler'
ModuleNotFoundError: No module named 'param-handler'  Hi, My... 'param-handler' How to remove the ModuleNotFoundError: No module named 'param-handler' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'param-medic'
ModuleNotFoundError: No module named 'param-medic'  Hi, My Python... 'param-medic' How to remove the ModuleNotFoundError: No module named 'param-medic' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'param-store'
ModuleNotFoundError: No module named 'param-store'  Hi, My Python... 'param-store' How to remove the ModuleNotFoundError: No module named 'param-store' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'pydrobert-param'
ModuleNotFoundError: No module named 'pydrobert-param'  Hi, My... named 'pydrobert-param' How to remove the ModuleNotFoundError: No module named 'pydrobert-param' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pytest-param'
ModuleNotFoundError: No module named 'pytest-param'  Hi, My Python... 'pytest-param' How to remove the ModuleNotFoundError: No module named 'pytest-param' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'param-store'
ModuleNotFoundError: No module named 'param-store'  Hi, My Python... 'param-store' How to remove the ModuleNotFoundError: No module named 'param-store' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'param-info'
ModuleNotFoundError: No module named 'param-info'  Hi, My Python... 'param-info' How to remove the ModuleNotFoundError: No module named 'param-info' error? Thanks   Hi, In your python environment you
difference between init() & init(ServletConfig config)?
difference between init() & init(ServletConfig config)?  I want to know the difference between init() and init(ServletConfig config) methods in GenericServlet
ModuleNotFoundError: No module named 'cudaminer-param-checker'
ModuleNotFoundError: No module named 'cudaminer-param-checker'  Hi...: No module named 'cudaminer-param-checker' How to remove the ModuleNotFoundError: No module named 'cudaminer-param-checker' error? Thanks   
ModuleNotFoundError: No module named 'django-param-field'
ModuleNotFoundError: No module named 'django-param-field'  Hi, My... named 'django-param-field' How to remove the ModuleNotFoundError: No module named 'django-param-field' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Eval-param-EM'
ModuleNotFoundError: No module named 'Eval-param-EM'  Hi, My... 'Eval-param-EM' How to remove the ModuleNotFoundError: No module named 'Eval-param-EM' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'  Hi...: No module named 'jenkins-jobs-hidden-param' How to remove the ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param' error? Thanks  
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'  Hi...: No module named 'jenkins-jobs-hidden-param' How to remove the ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param' error? Thanks  
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'  Hi...: No module named 'jenkins-jobs-hidden-param' How to remove the ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param' error? Thanks  
ModuleNotFoundError: No module named 'odoo10-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo10-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo10-addon-report-wkhtmltopdf-param' How...-wkhtmltopdf-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param' How...-wkhtmltopdf-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo11-addon-report-wkhtmltopdf-param' How...-wkhtmltopdf-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param' How...-wkhtmltopdf-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo12-addon-report-wkhtmltopdf-param' How...-wkhtmltopdf-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo9-addon-report-wkhtmltopdf-param'
ModuleNotFoundError: No module named 'odoo9-addon-report-wkhtmltopdf-param...: ModuleNotFoundError: No module named 'odoo9-addon-report-wkhtmltopdf-param' How...-param' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'cudaminer-param-checker'
ModuleNotFoundError: No module named 'cudaminer-param-checker'  Hi...: No module named 'cudaminer-param-checker' How to remove the ModuleNotFoundError: No module named 'cudaminer-param-checker' error? Thanks   
ModuleNotFoundError: No module named 'django-param-field'
ModuleNotFoundError: No module named 'django-param-field'  Hi, My... named 'django-param-field' How to remove the ModuleNotFoundError: No module named 'django-param-field' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Eval-param-EM'
ModuleNotFoundError: No module named 'Eval-param-EM'  Hi, My... 'Eval-param-EM' How to remove the ModuleNotFoundError: No module named 'Eval-param-EM' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'
ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param'  Hi...: No module named 'jenkins-jobs-hidden-param' How to remove the ModuleNotFoundError: No module named 'jenkins-jobs-hidden-param' error? Thanks  
ModuleNotFoundError: No module named 'jjb-reactive-choice-param'
ModuleNotFoundError: No module named 'jjb-reactive-choice-param'  Hi...: No module named 'jjb-reactive-choice-param' How to remove the ModuleNotFoundError: No module named 'jjb-reactive-choice-param' error? Thanks  
ModuleNotFoundError: No module named 'jjb-separator-param'
ModuleNotFoundError: No module named 'jjb-separator-param'  Hi, My... named 'jjb-separator-param' How to remove the ModuleNotFoundError: No module named 'jjb-separator-param' error? Thanks   Hi
Servlet Init method
Servlet Init method  can we capture the form data into the init method of the servlet
Access web.xml init parameters
Access web.xml init parameters  How to access web.xml init parameters from java code
ModuleNotFoundError: No module named 'init'
ModuleNotFoundError: No module named 'init'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'init' How to remove the ModuleNotFoundError: No module named 'init' error
JSP Include Param
JSP Include Param          JSP Include Param is used to pass parameter... The Tutorial illustrate an example from 'JSP Include Param'. To understand
Getting Init Parameter Names
;init-param>  <param-name>AdminEmail</param-name>  <param-value>[email protected]</param-value>  </init-param>  <init-param>  <param-name>Address</param
Struts2.2.1 param Tag Example
Struts2.2.1 param Tag Example This tag can be used to parameterize other... the param tag, the value can be defined in either a value attribute or as text...;> <title>Example of Param Tag</title> <
init method of ActionServlet and RequestProcessor
init method of ActionServlet and RequestProcessor  hi every when the ActionServlet init() method is executed? please give answer for the above query
Param Tag (Data Tag) Example
Param Tag (Data Tag) Example       In this section, we are going to describe the param tag. The param tag is a generic tag.... The parameters can be added with or without a name as a key.  The param
Standard Action "jsp:param"
; <jsp:include> Syntax:ADS_TO_REPLACE_1 <jsp:param name="...; <jsp:param name="myParam" value="ANKIT KAUSHAL"/> <jsp:param name="Age" value="15"/>
Passing Parameters using <jsp: param>
: param name="myParam" value="Amar Patel"/> <jsp: param name="Age" value="15"/> </jsp: forward> <
Version of cn.zhaiyifan>init dependency
List of Version of cn.zhaiyifan>init dependency
JSF param Tag
JSF param Tag      ... message where these param values can be used. Code Description : In the code below {0}and {1}are replaced by the param values specified within outputFormat tag
Facelet param Tag
Facelet param Tag      ...;  <ui:composition template="/pages/param/paramtemplate.xhtml...; <ui:param name="user" value="#{MessageBean.userid}"/>
ModuleNotFoundError: No module named 'dev-init'
ModuleNotFoundError: No module named 'dev-init'  Hi, My Python...-init' How to remove the ModuleNotFoundError: No module named 'dev-init... to install padas library. You can install dev-init python with following
ModuleNotFoundError: No module named 'mine-init'
ModuleNotFoundError: No module named 'mine-init'  Hi, My Python... 'mine-init' How to remove the ModuleNotFoundError: No module named 'mine-init' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'mine-init'
ModuleNotFoundError: No module named 'mine-init'  Hi, My Python... 'mine-init' How to remove the ModuleNotFoundError: No module named 'mine-init' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'npg-init'
ModuleNotFoundError: No module named 'npg-init'  Hi, My Python...-init' How to remove the ModuleNotFoundError: No module named 'npg-init... to install padas library. You can install npg-init python with following
ModuleNotFoundError: No module named 'pcart-init'
ModuleNotFoundError: No module named 'pcart-init'  Hi, My Python... 'pcart-init' How to remove the ModuleNotFoundError: No module named 'pcart-init' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'pip-init'
ModuleNotFoundError: No module named 'pip-init'  Hi, My Python...-init' How to remove the ModuleNotFoundError: No module named 'pip-init... to install padas library. You can install pip-init python with following
ModuleNotFoundError: No module named 'pkg-init'
ModuleNotFoundError: No module named 'pkg-init'  Hi, My Python...-init' How to remove the ModuleNotFoundError: No module named 'pkg-init... to install padas library. You can install pkg-init python with following

Ads