Q:

passing relative path in tomcat

I have servlet that sends email:
 msg.setContent("<p>Please follow this <a href=\"http://localhost:8080/examples/RSI/ConfirmedResetPasswordPage.jsp?action=<%=userID%>\"> link </a>to reset your password",
                        "text/html" );

Does anyone know how to make this link a relative path to ConfirmedResetPasswordPage.jsp page?

A:

You can't put relative path in the email. Assuming that you mean, you don't want to hardcode the server url and you have access to HTTPServletRequest request object, you can use request.getServerName() or request.getRequestURL() methods to figure out server url. 

