2

サーブレットで 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 に 2 つの拡張子が含まれている可能性があります。

ブラウザは正確に何を言っているのですか?それはいつ言いますか?

于 2013-05-17T02:27:18.970 に答える