Deploying UAT and PROD instances of web application in same Tomcat instance

Hi Team
I have a question on deployment in PRODUCTION and User Acceptance Test versions while I have to do it in the same machine: What is the recommended way while we want to deploy in PROD and UAT versions of the application, should we change the module prefix before build in DEVELOPMENT environment? In this case is there any suggestions regarding database connection --> UAT or PROD?