2016-06-21 196 views
1

我想在將URL重定向到其他服務器上的頁面時隱藏該URL。 對於EG: 這是index.jsp頁面如何隱藏地址欄中的Url?

<body> 
<form id="inset_form" > 
<input type="submit" value="GO" onclick="func();"> 
</form> 
</body> 

當有人點擊提交就會去的servlet。

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
     // TODO Auto-generated method stub 
     System.out.println("Post"); 
     response.sendRedirect("https://stackoverflow.com/questions/14018215/what-is-url-pattern-in-web-xml-and-how-to-configure-servlet"); 
    } 

現在會重定向到頁面另一臺服務器上

https://stackoverflow.com/questions/14018215/what-is-url-pattern-in-web-xml-and-how-to-configure-servlet 

現在我想這樣的網址:中 https://stackoverflow.com/questions/anotherPage

代替

https://stackoverflow.com/questions/14018215/what-is-url-pattern-in-web-xml-and-how-to-configure-servlet 

但應只有一些隱藏的信息纔會重定向到同一頁面。

如果可能的話請幫忙。

在此先感謝。

+0

試圖找到關於mod_rewrite的信息。不知道jsp如何完成,但你幾乎可以改變URL –

回答

1

除非你計劃你的服務器要考慮

page.com/way-to-long

是一樣

page.com/better

然後我不確定這是可能的。它不能在純JavaScript中完成,因爲編輯URL可能會導致網絡釣魚詐騙(我可以在加載完成後將我的網站的URL改爲facebook.com)。其他人鏈接如何使用Apache的Surver上的Mod_rewrite。