I have a web application that is running .. lets say the url is www.submission.com/submit . I have a saperately developed web app that I would like to deploy at the location www.submission.com/submit/test.
How can I do this ?? Can I put the war file of the new application in the lib folder of the existing application and configure the web.xml to call that web application for that url pattern ?? I am not sure .. Just speculating ..
No, you cannot place a WAR within a WAR. Each WAR is a stand-alone entity and its structure is defined by the J2EE spec - which among other things says that certain files and directories must be located at certain absolute places within the WAR file. Exploding the WAR file into a physical disk directory tree doesn't change that.
But what you really want is to provide 2 different contexts, where one context path is and extended version of the other context path. Since each context can locate its WAR anywhere it wants, actual physical embedding of a WAR isn't required.
The real question is "can Tomcat be directed to match first against a longer context path, then fall back to a shorter path if the longer match fails?". I don't know. It might even do that by default, although I'd have to RTFM, or maybe even the source code.
Assuming it doesn't, however, an alternative would be to employ a URL rewriting scheme so that, for example www.submission.com/submit/test remaps to www.submission.com/test and www.submission.com/submit (without the "/test") passes through unchanged.
An IDE is no substitute for an Intelligent Developer.