简体   繁体   中英

functionality of tomcat servlet container

ServletContainer reads the user defined servlet class name from web.xml file by converting web.xml file into DOM object. I don't understand how servlet container converts this and where this DOM object (web.xml data) resides inside web-app directory of server?

The Java EE specification mandates a specific directory and packaging structure (war) for web applications so that the web app can be deployed on any servlet container (Tomcat is one of them) without any modifications. Now, each servlet container can unpack it in which ever way it wants and as a developer you no need to worry about it.

Now, Tomcat places all the deployed applications in the \\tomact-install-dir\\webapps directory. Each web app will be in its own folder with webapp name as thefolder name.

Perhaps this is the first place to take a look at when deploying the first web application. tomcat deployment hierarchy .

web.xml should be placed inside the WEB-INF on your webapp deployment. Some servlet containers allow you to have generic or reusable web.xml files inside their configuration directories but that's not standard AFAIK (It's better for your webapp to be selfcontained most of times)

You shouldn't need to know about the parsing of the XML file since it's all handled by the servlet container under the hood. (Just place it in the right place)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM