you're just scratching the surface at what could be a larger can of worms b/c what are you going to do as soon as you have multiple files that need to change per environment, or you start including ejbs that need to have their deployment descriptors tweaked per environment.
i just completed re-writing our entire build process and i opted to just redo the build each time we switch environments.
if any of your code is dependent upon the values that change per environment, then the statement about "guarenteed-tested" code is no longer applicable b/c the code may work w/ the "test" value, but may not work w/ the "production" value.
i'm also curious to see how others have overcome this issue, since i'm told the "rebuild" solution breaks configuration management best practices.
don't know about best practices but for testing I deploy the component multiple times with different configs and run test suites against each deployment
for packaging I use a target per target environment
Would it be possible to use a regular java system property instead that could be initiated using your run.sh/tbat
I'm not sure if it works in web.xml though....