Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

about struts-config file

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67671
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please give me reply
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic