General J2EE: is it possible to write a file into a running xxx.war web app?

  1. In my app, users need to select some kind of "code:name" option, for example, <option value="001">Canada</option> which datas seldom change. I create a js file to hold both datas and logic to display datas as html <select> and linked it in jsp files. All of those files are within a war archive which within a ear archive.
    The problem is: when the ear is deployed and running, sometimes I need to regenerate the js file to hold more datas(by a javabean also within war), for example, to add a new country, I can't find a way to make this work.
    So, would anyone please help me?
    Or... there is a better solution for this requirement? the real situation is: when the country is selected, user need to select corresponding province and then city... I solved all the display logic and datas in one js file. So, any other solutions?
  2. I believe the better way to do it is to extract the display data into a property file, which is out of the ear file. In this way, it should be easy for you to regenerate. In your application, you just need to use JavaBean/JSP to read the data back into the application.