【发布时间】:2017-12-31 10:13:28
【问题描述】:
我在某个域名 ABC.com 上有我的生产应用程序。在我的代码中,我根据某些操作将用户重定向到其他页面
response.sendRedirect(request.getServletContext().getContextPath() + "/time");
但是通过上面它被重定向到 localhost:8080//time 但不是这个,我希望它被重定向到 ABC.com/time
我该怎么做?我想到一个简单的解决方案是我应该为生产设置一些环境变量,而不是使用
request.getServletContext().getContextPath()
,我将使用环境变量值,即 ABC.com
【问题讨论】: