Say in my web.xml file, I define a servlet like so:
<url-pattern>/MyURL/*</url-pattern>
How do i access anything passed in the * in my servlet? I’m planning to use use this scheme for pretty(-ish) URLs.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
HttpServletRequest#getPathInfo()is exactly for this purpose.That’s all. No need to substring the servlet path from it as suggested in another answer here. Also see my answer on your other question.