jsp - What does the following entry in web.xml refer to? -


one under root webapps/root/jsp/error.jsp , other under webapps/documents/jsp/errorpage.jsp , web.xml entry follows

<servlet>     <servlet-name>errorpage</servlet-name>     <servlet-class>org.apache.jsp.jsp.error_jsp</servlet-class> </servlet> <servlet-mapping>     <servlet-name>errorpage</servlet-name>     <url-pattern>/jsp/errorpage.jsp</url-pattern> </servlet-mapping> 

in general web.xml contains servlet , servlet-mapping entry. servlet-mapping entry contains url , servlet entry contains servlet path upto understanding.

i couldn't understand above entry in web.xml. please me know it.

from servlet specification: the servlet-class element contains qualified class name of servlet.

you specify container (tomcat) that: org.apache.jsp.jsp.error_jsp qualified class name of servlet called errorpage.

from servlet specification: the servlet-mappingtype defines mapping between servlet , url pattern.

you specify container requests url /jsp/errorpage.jsp must responded server errorpage.

example:

tomcat receives first (i.e. first request servlet since app start) http request having url /jsp/errorpage.jsp;

tomcat loads class org.apache.jsp.jsp.error_jsp, creates instance of class, initializes servlet , calls doget() method of servlet.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -