Wildcard path for servlet?

大城市里の小女人 提交于 2019-11-27 21:36:49
BalusC

You can use * as prefix or suffix wildcard. In your case, you can use /myServlet/* for a folder mapping.

@WebServlet("/myServlet/*")

The path info (the part after the mapping in the URL) is in the servlet by the way available as:

String pathInfo = request.getPathInfo();

This would in case of myapp/myServlet/other return /other.

See also:

use "/myServlet/*" as your servlet mapping.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!