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 the default location of result pages and how can we change it?

780


How many servlet controllers are used in a Struts Application?

832


How to use forward action to restrict a strut application to mvc?

817


Which interceptor is responsible for i18n support?

710


How does struts2 token work?

733


Explain about struts relation to html tags?

758


Name some useful annotations introduced in Struts2?

736


What steps are required to for an application migration from Struts1 to Struts2?

823


What configuration changes are required to use Tiles in Struts?

773


What does apache struts do?

711


How is the mvc design pattern used in struts framework?

731


How you will display validation fail errors on jsp page?

734


What is the difference between Jakarta Struts and Apache Struts? Which one is better to use?

796


How client side validation is enabled on a jsp form?

790


How do you create message resource?

797