what is the purpose of load_on_startup entry in struts-
config.xml?

Answer Posted / srinu

If load_on_startup is not enabled in web.Xml then the
servlet crates the object that class and sevletConfig object
will be created after constructor will be executed after it
will go to life cycle methods in servlets.i.e means lot of
processing will be done when load-on-startup is not enabled.

If load_on_startup is enabled then that moment when
WEBAPPLICATION is deployed all lot of processing will be done.
Then immediately executes LIFECYCLE method in servlets

Problem: suppose our webapplication contain 10 servlets then
which servlet object will be created?

solution: for this problem If we use load on startup web
container creates the objects based on the proirity when
there are mutliple servlets.We use load_ on_ start up for
giving the proirity.

Note:1 is highest priorty
2 is next highest priorty
-1 ignores that value
EX:<load-on-startup>1</load-on-startup>

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does apache struts run on windows?

546


How does one create an action in struts 2?

532


How struts2 supports internationalization?

662


What is the use of jsonvalidation in struts?

561


What are apache struts?

521






What does execandwait interceptor?

560


What is the purpose of @beforeresult?

615


What are the life cycle methods of interceptor?

528


What is interceptor struts2?

541


How we can controlled duplicate form submission in struts?

529


What is the difference between requestaware and servletrequestaware interface?

591


What are the features of struts?

583


Give the details of xml files used in validator framework?

598


How many struts config file can be created in struts?

505


What is the difference between filters and interceptors ?

508