I am new in Servlets and web.xml content. I would like to set a condition/dependency on two different servlets. Consider I have below two servlets:
<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>com.my.app.Servlet1</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>servlet2</servlet-name>
<servlet-class>com.my.app.Servlet2</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
And I would like to invoke servlet2 only in case servlet1 encounters an error or fails. As to be a scenario: Assume servlet1 is my main authenticator and the user login failed due to missing parameter in URL in servlet1. In that case I would like to try the second authenticator servlet2 that contains different set of checks...
Can I achieve this by modifying web.xml only? If not, what would be an alternative solution to accomplish this need?
Note: I do have the source code of servlet1 but not the servlet2 (only built jar)...
Thanks in advance.