• Post Reply Bookmark Topic Watch Topic
  • New Topic

Editing web.xml

 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Why Servlets API / J2EE API doesn't contain any methods to edit web.xml file?
Is it fine if to edit web.xml file through my program using some XML parser ?
If not then why?

Cheers
 
Bhushan Jawle
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container reads web.xml while starting up so it would be of no practical use to provide API to modify web.xml programmatically as that changes cannot be used by application.
Thanks,
Bhushan
 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If application is restarted then changes made to web.xml will be reflected.
lets take the case of Web master email ID. In my application I will have UI, which will edit this property. I can have it in application scope variable. Also I want update the same in web.xml so that changes are reflected once my application is restarted.
Cheers.
 
Bhushan Jawle
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml is deployment descriptor and should be used for just for that. Persistence can be achieved by other persistent storage methods like db. etc.
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Bhusan says the Web.xml file should not be modified by the application. Any changes that you make to the Web.xml file will be lost when you deploy the next release to the server.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!