Search code examples
grailsweb.xml

How to edit web.xml in Grails?


When you do a grails create-app, it doesn't look like a web.xml gets generated anywhere. According to the latest docs, it sounds like running grails install-templates will place web.xml to your src/templates/war directory. A few questions about this:

  • We are currently on Grails 2.4.4: is this still the modern/recommended way of accessing your web.xml and making modifications to it?
  • Can someone confirm that modifying this generated web.xml (e.g. adding a servlet filter) will actually override and take affect when the app runs?

Solution

  • Yes, that's still the accepted method for modifying web.xml in Grails 2.4.x and yes, the changes you make there will be reflected in the deployed application.