GeeCON Prague 2014*
The moose likes Struts and the fly likes Doubt regarding Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Doubt regarding Struts" Watch "Doubt regarding Struts" New topic
Author

Doubt regarding Struts

Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 43
1. In struts 1.x, how many times the struts-config.xml will be read? Fir each request or only once when the 1st request comes???

2. In struts 2 who will read the struts.xml. I know the ActionProxy is responsible to read it. If that is the case how the FD-->ActioMaper---> ActioMappoing will decide whether to include the action or not?? Here ActioMapping class also will read the struts.xml or what?? Please clear my doubts in details.

Thanks in advance,
Geeta
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Class responsible for reading struts.xml

It will read only once but you can override it to reading on each and every request



When enabled, Struts 2 will reload your resource bundles on every request (meaning you can change your .properties files, save them, and see the changes reflected on the next request).

For further details refer the following link Struts2 DevMode


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Sandy Chatterjee
Ranch Hand

Joined: Jun 27, 2012
Posts: 55

In struts 1.x, how many times the struts-config.xml will be read? For each request or only once when the 1st request comes???


For each request the struts-config.xml will be read, not from the file but from the objects created with the configuration file.
When the first request comes, in the init() method, the ActionServlet reads the Struts Config file and creates appropriate Struts
configuration objects (data structures) into memory. Creating configuration objects is an one time process.
But for each and every request the configuration object is read to create ActionMapping object for that particular request.


Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 43
Mohana Rao Sv wrote:Class responsible for reading struts.xml

It will read only once but you can override it to reading on each and every request



When enabled, Struts 2 will reload your resource bundles on every request (meaning you can change your .properties files, save them, and see the changes reflected on the next request).

For further details refer the following link Struts2 DevMode


k. In struts1 xml file will read only once Then what about in struts2??
 
GeeCON Prague 2014
 
subject: Doubt regarding Struts