Case 1
<servlet-mapping>
<servlet-name>myapp</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Case 2
<servlet-mapping>
<servlet-name>myapp</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
If I use case 1 then I dont get any of my pages styled with <link rel="stylesheet" type="text/css" href="${contextPath}/assets/styles.css" />
, but if I use case 2 everything gets styled.
Could someone help me understand why?
Also, could someone tell me which pattern should be used so that I don't have to worry about extensions? Like should I be using /*
? The thing is that if I use /*
now when I've been using *.do
while developing my application, everything seems to be breaking, not only the styles but I don't get any pictures rendered, no JCaptcha and all that has to do with links.
And If I try to send a GET request from a REST Client like http://localhost:8080/myapp/user/1
it doesn't work and I need to add .do
at the end and send the same request like http://localhost:8080/myapp/user/1.do
.
Thanks.