我正在我的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链接的正上方,但是浏览器抱怨它是一个无效的链接..如何克服这个?
答案 0 :(得分:0)
问题可能是您在该网址中有两个扩展程序。
浏览器到底在说什么?什么时候说呢?
答案 1 :(得分:0)
这是由于您的应用程序在分配给href之前先检查了链接,例如在CQ5应用程序中,我正在使用x-cq-linkchecker =“ skip”来禁用此问题。因此在您的应用程序中,请检查是否存在任何链接检查器。