Angelina
Angelina

Reputation: 2265

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?

Upvotes: 0

Views: 42

Answers (1)

jny
jny

Reputation: 8057

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.

Upvotes: 1

Related Questions