What is the meaning of web.xml id attribute of the web-app tag?
Eclipse generated it as id="WebApp_ID". I was using version the Servlet specification version 2.5, I switched to using 3.0, with the suggestion of this answer that doesn't include that id.
Is it really necessary? What is the value supposed to be?
Web apps often require users to authenticate to access protected content. App ID uses the OIDC authorization code flow to securely authenticate users. With this flow, when the user is authenticated, the app receives an authorization code. The code is then exchanged for an access, identity, and refresh token.
XML. The web. xml file is derived from the Servlet specification, and contains information used to deploy and configure the components of your web applications. When configuring Tomcat for the first time, this is where you can define servlet mappings for central components such as JSP.
Browse to the webapps\ch11\WEB-INF directory, and click Open. Then in the New File dialog that appears, enter the name of the file to link to, web. xml , and click OK. This adds web.
The newer versions of the servlet spec use .xsd files with no further information on the id attribute, but if you go back to the older versions with .dtd, such as web_app_2_2.dtd, you find:
The ID mechanism is to allow tools to easily make tool-specific references to the elements of the deployment descriptor. This allows tools that produce additional deployment information (i.e information beyond the standard deployment descriptor information) to store the non-standard information in a separate file, and easily refer from these tools-specific files to the information in the standard web-app deployment descriptor.
For example, WebSphere Application Server used the id mechanism in its old bnd and ext files:
web.xml:
<web-app id="WebApp_ID" ...
ibm-web-app-bnd.xmi:
<webappbnd:WebAppBinding ...
<webapp href="WEB-INF/web.xml#WebApp_ID"/>
(Thankfully, this is tool-friendly-but-developer-annoying use of id attributes is no longer necessary with the newer .xml file format for ibm-web-bnd/ext, but I digress.)
AFAIK this is not needed (per the DTD as well). You can comment it out and see if that works, I am quite positive the app will load up just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With