Thursday, 29 March 2012

Servlet Mapping


Servlet Mapping

This mapping is specified with the help of servlet name in web.xml file, we can map servlet class with url pattern. In web.xml we have two child tags <servlet-name> and <url-pattern>.<servlet-name> specifies the name of the servlet, which is called for incoming URL pattern matching by giving values in<url-pattern> element Every<servlet> element  have two child elements - <servlet-name> and<servlet-class>. Servlet name and url pattern should be same as shown.







Definining Servlet Mapping



Location where web.xml is stored

Web xml is made in webapps àWEB-INF à web.xml(save here).
As per the folders shown above we can save our files accordingly like html file in META-INF and similarly jsp page as well as css files, images in images folder similarly scripts.Any program we want to make can be stored in classes the compiled from there.





Implicit  Mapping


Servet can contain JSP(.jsp) extensions we map jsp page to servlet with the help of servlet engine and jsp page is converted into servlet this is called Implicit Mapping. Servlet Mapping and Implicit Mapping are different as in servlet mapping we use url pattern for mapping of servlet whereas here in implicit mapping its automatic i.e jsp pg is converted into servlet with the help of servlet engine




No comments:

Post a Comment