我正在我的 servlet 中编写指向 Printwriter 的 href 链接。但浏览器将其显示为无效链接。
这是我的代码:
String path = request.getRequestURI();
path = path.substring(0, path.lastIndexOf('/'));
path = path + "/open-Account.html.html" ;
StringBuffer openAccountLink = new StringBuffer();
openAccountLink .append("<a href=").append("\"").append(path).append("\"");
openAccountLink .append(">").append("Create an account").append("</a>");
out.write("</br>");
out.print(openAccountLink .toString());
URL in the log:<a href="/content/pages/location/en_us/user/open-Account.html.html">
我的日志显示右上方的 href 链接,但浏览器抱怨它的链接无效..如何克服这个问题?