2

我正在我的 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 链接,但浏览器抱怨它的链接无效..如何克服这个问题?

4

2 回答 2

0

问题可能是您在该 URL 中有两个扩展名。

浏览器到底在说什么?什么时候说的?

于 2013-05-17T02:27:18.970 回答
0

这是由于您的应用程序在分配给 href 之前检查了链接,例如在 CQ5 应用程序中,我使用 x-cq-linkchecker="skip" 禁用检查这解决了我的问题。所以在您的应用程序中,请检查是否存在任何链接检查器。

于 2018-11-15T11:40:26.660 回答