title: Tomcat: context.xml and web.xml configs for jndi resource
body: <p>I have been going over almost all the web.xml/context.xml related questions over the web but nowhere did i get a clear enough answer to my following question.
  <a href="https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions" rel="nofollow noreferrer"> <strong>This</strong></a> says that the <strong>resource-ref</strong> tag in web.xml is equivalent to <strong>Resource</strong> tag in context.xml. 
  <a href="https://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example" rel="nofollow noreferrer"> <strong>This</strong></a> says that <strong>resource-ref</strong> tag in web.xml looks up the <strong>Resource</strong> tag in context.xml. Now these two sound confusing specifically because both the links I have referred to are Tomcat doc links and still have seemingly contradictory statements. Any clarifications would be extremely helpful.</p>