How to get initialization time (init () method)values in servlet?

Showing Answers 1 - 4 of 4 Answers

Dileep

  • Oct 24th, 2005
 

Using servletconfig interface initialisation parameters can be achieved

  Was this answer useful?  Yes

Srini

  • Oct 28th, 2005
 

servletconfig is a wrapper class object which can be used to retrive initilise parameters from web.xml file and wrappes into servlet instance.

in this way sevlet constructor is dynamically initilised.plz send me comments on answer   

  Was this answer useful?  Yes

Mukesh Kumar

  • Nov 15th, 2005
 

This can be done by using the getInitParameter(String name ) method of the ServletConfig interface. Here name is the init parameter name

  Was this answer useful?  Yes

siva kumar reddy

  • Jul 31st, 2006
 

getInitParameter() method is available in servletConfig and ServletContext();

by using this method we get values of init parameter and context parameter.

ex:

for suppose in web.xml we configure like this

<init-parameter>

<parameter-name>aaa</parameter-name>

<parameter-value>AAAAA</parameter-value>

</init-parameter>

get the value of init parameter in servlet:

ServletConfig config=getServletConfig();

String x=config.getInitParameter("aaa");//it returns AAAAA

cheers

siva

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions