I was reading Head First JSP and Servlets book. I was going through the mapping of servlet. And my doubt here is
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>com.avinash.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/ServletBeer.do</url-pattern>
</servlet-mapping>
- Why should the
url-pattern
start with forward slash(/
)? - What does the forward slash(
/
) represent? Does it represent our webapp name? - What happens if the
url-pattern
do not start with forward slash(/
)? - Is it a specification to start with forward slash(
/
)?
And in the book it is clearly mentioned:
Don't forget the forward slash(/) in the url-pattern.
Can you explain?
See Question&Answers more detail:os