jsp - Servlet path "/" returns that servlet content for any request pattern -
When I mapped the servlet with the path like this:
& lt ; Servlet & gt; & Lt; Servlet-name & gt; Home1Servlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Com.project.servlets.Home1Servlet & lt; / Servlet category & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; Home1Servlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / & Lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt;
And then when I request a servlet from the browser via any other way:
http: // localhost: 8084 / project / http: / / Localhost: 8084 / project / adh: http: // localhost: 8084 / project / why http: // localhost: 8084 / project / hell
all these requests have the same home page content Why come back?
How can mapping सर्वोलेट only for "path"?
I am using ApacheTMAC 6.0.26, JavaEE 5.. The reference path is: / project
If you want to map only servlet to route url then Use empty mapping:
& lt; URL pattern & gt; & Lt; / Url pattern & gt;
This servlet specification is described in 12.2:
An empty string ("") is a special URL pattern that actually maps the reference to the application map That is, the request of the form host: ports / & lt; Context_root> / Path information / and servlet path and reference path empty strings ("") in this state.
Comments
Post a Comment