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

What is struts-default package and what are it’s benefits?

579


What is the difference between requestaware and servletrequestaware interface?

580


How can we display validation errors on jsp page?

539


Are interceptors and filters different?

548


What’s the difference between struts and espresso?

504






Explain architecture of struts2?

588


What do you mean by ognl?

554


Mark the differences between html tags and strut specific html tags.

590


What is validate() and reset() functions?

568


What is s token?

539


What are the core components of a struct2 based application?

564


What does modeldriven interceptor?

593


How to display validation errors on jsp page?

568


What is the purpose of @doublerangefieldvalidator?

616


Explain the complete struts validator framework.

579