This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi friends, I am working in sttruts. I have one doubt in struts, about struts-config file. In struts frame work if you extract jar file and open that every class file. You can see the code. My doubt is we are laoding the struts-config file in the ActionServlet class init method. IN that method we are getting the file. Where are you storing that file. For every action action we have to go for that file and we have to parse that file. Is it necessary to load that file for every time when ever you need it.
I am not completely sure what your question is. My understanding is that the ActionServlet loads and parses the struts-config file only once at startup (in the init method) and then stores the contents in an in memory structure.
Hi Bent, You have answered correctly for my doubt. " ActionServlet loads and parses the struts-config file only once at startup (in the init method) and then stores the contents in an in memory structure."
And another question is where it stores, is it in jvm or where it store. The main reason behind this is, i want to write another configuation file that which i want to go and search in that file for very request. So without loading and searching every time i want to load it , but i am not finding solution how and where to load it actually.
Please give me the solution for this
Thanks in advance sekhar
Joined: Apr 05, 2006
please give me reply
Joined: Feb 08, 2006
One of the benefits of an open source project like Struts is that you can look at the source code to answer your technical questions. Just download the source code for the version that you have and dig in. You can probably even set up your debugger to step through the Struts code (though I have not done this...you may have to rebuild the Struts code to get debug info). I suspect that it stores this at application scope but I am not sure how to get at the data.
Struts puts most of the configuration information into a ModuleConfig instance that is kept in Application Scope. The RequestProcessor also adds it to request scope for every request. You can find more information about the ModuleConfig object in the JavaDoc. To retrieve it from application scope in an Action class, you'd use the following code:
[ February 22, 2007: Message edited by: Merrill Higginson ]