1

I want some kind of mechanism that will store new generated data in **web.xml** file. Suppose new user is created and I want to store his **username and password (*login credentials*) in web.xml** file at the user creation time then what I ll have to do ? In my system users are also limited in numbers so there is no worry in writing small amount of data in **web.xml** file.

And if possible then I want to write that data in encrypted form in web.xml file. Encryption is later stage but first of all I want to know that how to write dynamically generated data in **web.xml** file ?

And after writing that data to **web.xml**, whenever I need it how can I read that data from **web.xml** ?

I am using Java as Base Language.

Any proper way for to implement it ??

KesaVan
  • 1,031
  • 16
  • 32
Java Curious ღ
  • 3,622
  • 8
  • 39
  • 63
  • 1
    `Suppose new user is created and I want to store his username and password (login credentials) in web.xml file at the user creation time then what I ll have to do ?`, Simply don't do it. That's really weird. Use some database – Suresh Atta Dec 04 '13 at 05:48
  • Instead use database with encryption. – Vimal Bera Dec 04 '13 at 05:48
  • Ok then will you simply tell me that what to do to write data in web.xml file ? Becuase later time I am going to write some encryption key in it. – Java Curious ღ Dec 04 '13 at 05:49
  • Any change to a web.xml will also cause the whole web app to reload. – Scary Wombat Dec 04 '13 at 05:49
  • @VimalBera - Yes I have tried that one but I also need that to store `master key` for encryption in `web.xml`, so I am looking for a way to write data in `web.xml.` – Java Curious ღ Dec 04 '13 at 05:51
  • @user2310289 -Sir I also need a way to reload whole webapp to solve my this question. http://stackoverflow.com/questions/20187869/how-to-refresh-static-resources-in-java-web-application – Java Curious ღ Dec 04 '13 at 05:54
  • As other commenters are saying - do not do it this way. – Scary Wombat Dec 04 '13 at 06:00
  • @user2310289 - Then where to store new uploaded data ? At which specific directory that not need to refresh & also of outside the web application ? – Java Curious ღ Dec 04 '13 at 06:02

1 Answers1

3

Web.xml is a deployment descriptor for your web application, which describes the servlet mappings, welcome pages, etc for your web application. It is not meant for storing transactional data. It is sounding like you do not want a database to store user generated data (logins / passwords / etc ) - instead store it on a filesystem. There are several ways of doing this. For example - if you are using Spring framework - You could use FileSystemResource class to get a handle to a file and perform write / read operations.

Neocy
  • 166
  • 2