2016-06-21 166 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。