Monday 14 July 2014

Why Servlet Mapping required ?

Since it allows servlets to have multiple servlet mappings.

<servlet>
    <servlet-name>Hello</servlet-name>
    <servlet-path>Hello</servlet-path>
</servlet>

<servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/Welcome</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/WelcomeWorld</url-pattern>
</servlet-mapping>


As you observe the url-patterns '/WelcomeWorld', '/Welcome', and '/HelloWorld' all are matched to same class 'Hello'





Prevoius                                                 Next                                                 Home

No comments:

Post a Comment