Unfortunately, that's not really possible.
Ideally, you have a webapp, a server-independent deployment descriptor (the web.xml file) and a server-dependent deployment descriptor (for
Tomcat, that's a Context definition). You then feed them to a JSR-188 compliant webapp deployer and Bob's your Uncle.
In Real Life, both webapp server brands and versions are too different. Tomcat (and jeTTY) don't implement the full
J2EE stack, so any support for persistence, messaging, and other extended J2EE services has to be handled the hard way - usually by including extra JARs into the webapp. More subtle differences in spec implementations can be a problem with full-stack deployments. And then there's the issue of whether the target server implements the same version of JEE as your app is written to.
Failing that, a good build tool such as
Maven can be used to make the task of producing these different variations on a theme more manageable. Maven offers "profiles", so you have build with a "tomcat" profile, a "weblogic" profile, a "glassfish" profile, and so forth.