aspose file tools*
The moose likes Struts and the fly likes about struts-config file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "about struts-config file" Watch "about struts-config file" New topic
Author

about struts-config file

Sekhar Chand
Ranch Hand

Joined: Apr 05, 2006
Posts: 73
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.

please clear my doubt.

with best regards
Nani
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

"Sekhar",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sekhar Chand
Ranch Hand

Joined: Apr 05, 2006
Posts: 73
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
Sekhar Chand
Ranch Hand

Joined: Apr 05, 2006
Posts: 73
please give me reply
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
 
Consider Paul's rocket mass heater.
 
subject: about struts-config file