S
shaoanqing
hi
I am coding for a WebApp
I wrote a servlet and defined the mapping in web.xml like:
<servlet>
<display-name>MySer</display-name>
<servlet-name>MySer</servlet-name>
<servlet-class>com.santa.servlet.MyServlet</servlet-class>
<load-on-startup>30</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/service/MySer</url-pattern>
</servlet-mapping>
I am now can access the servlet using the URL:
http://localhost:8080/myapp/service/MySer
the question is how can I get the URL from the servlet Context
or at least how can I get the url pattern("service/MySer") from
servletContext?
thanks.
I am coding for a WebApp
I wrote a servlet and defined the mapping in web.xml like:
<servlet>
<display-name>MySer</display-name>
<servlet-name>MySer</servlet-name>
<servlet-class>com.santa.servlet.MyServlet</servlet-class>
<load-on-startup>30</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/service/MySer</url-pattern>
</servlet-mapping>
I am now can access the servlet using the URL:
http://localhost:8080/myapp/service/MySer
the question is how can I get the URL from the servlet Context
or at least how can I get the url pattern("service/MySer") from
servletContext?
thanks.