开发者

Creating fake URL in Java

I am working on an ERP project. We have a URL like this: dom开发者_Go百科ain.com/home-appns keeping this URL for the request I want to display another URL in address bar like: domain.com\home\home-appns.

I an looking for solutions using Java/javascript.


I don't think there is a way to make the browser's address bar show something other than the URL of the page that is currently being displayed.

That limitation is probably a good thing, since it would allow nasty websites to spoof the user.


Are you looking for URLRewriting? It can be done using JSPs or Servlets.

I am not sure if you can do this properly using Javascript, but you can change the address of the page using, but I would suggest using it at Server Side.

Check out the article on Wikipedia to get a fair info on it.


Create a servlet and in web.xml, where the servlet is defined, add tag url-pattern. Write corresponding url pattern in it. In this servlet, now use response.sendRedirect("URL"). Now your browser will show url-pattern instead of URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜