What is deployment descriptor?

When you deploy your application in the container you have to create a simple XML document called deployment descriptor to tell the container how to run the servlets and jsps.
Example:
<web-app>
<servlet>
<servlet-name>x</servlet-name>
<servlet-class>hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>x</servlet-name>
<url-pattern>/hello.do</url-pattern>
</servlet-mapping>
<servlet>…………………</servlet>
<servlet-mapping>…………………………………..</servlet-mapping>
</web-app>
Three elements in the dd
1-<web-apps>
2-<servlet>
3-<servlet-mapping>
<servlet> maps the internal name(x) to the actual servlet name(hello).
<servlet-mapping>maps the internal name to the public URL name(hello.do).
You can use the DD for many other aspects like security role,initial configuration information, error pages etc. DD gives you a way to declarative modify the application without changing the source code.

No comments:

Post a Comment