Harish
Harish

Reputation: 21

Creating fake URL in Java

I am working on an ERP project. We have a URL like this: domain.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.

Upvotes: 1

Views: 1812

Answers (3)

Logan
Logan

Reputation: 2505

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.

Upvotes: 1

midhunhk
midhunhk

Reputation: 5554

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.

Upvotes: 2

Stephen C
Stephen C

Reputation: 718718

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.

Upvotes: 3

Related Questions