Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about struts-config file

 
Sekhar Chand
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Sekhar Chand
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please give me reply
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic