title: Using application scope variables in java
body: <p>My company is redoing our website over the next few months, going from a ColdFusion website to one written in Java.  I am just learning Java and I am curious as to how I can set application scope variables in a Java web application.  ColdFusion has the application.cfm file that holds variables that are accessible by all ColdFusion pages/components within the app.  Java obviously does not have a direct equivalent to that file, so I was wondering how to recreate something similar in Java.  I want to have one central place that all jsp pages, servlets, classes, etc. in the webapp can access.  </p>
  
  <p>So what is the best way to do something like that?</p>
  
  <p>Does anyone have any examples of something similar that they did?  </p>
  
  <p>Should application scope variables be placed in a class? an xml file? a jsp page? something else?</p>
  
  <p>Is it even feasible to have application scope variables a in java webapp?</p>
  
  <p>Example:
  It would be a place that holds say the path to an images folder, so in individual JSP pages or classes or whatever would need acces to that images folder, you could reference the application scope variable for that path instead of writing it out in each place.  Then if for some reason we needed to move the location of that images folder, we would just change the path variable in the one location and not have to update 20 places that reference that images folder.</p>
  
  <p>I have had trouble finding any information on this type of thing in my research online, which is why I am asking about it here.  I know it is a lot to ask for an explanation to this type of thing, but I figured I would ask and see what type of responses I could get.</p>
  
  <p>Thank you for any help you can provide about this topic.</p>