Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hiding URL address with a fake one

 
Cathy Cruise
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am currently using Servlet and Jsp to do a webpage. I would like to know, is there anyway to hide the URL address with a fake one? I know someone was able to did that. I was reading his code, and I couldn't find the trick. Does anyone know?

Thanx in advance
Cathy
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cathy,
One way to do this is to submit to the "fake" URL. That URL maps to a servlet which forwards you to the real servlet/JSP.
 
Shankar Narayana
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ex: web.xml


in your jsp your action would be like



Maintain a constant variable with the hidden field and check that in the servlet, corresspondingly redirect to the jsp.
 
Cathy Cruise
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hum... is there any other way beside this?


Cathy
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cathy,

If you're just after hiding the URL in the address bar then you can always wrap your page in a FRAME, but this is nasty, nasty, nasty! It also only hides the URL from the non-technical user.

Jules
 
Ashish Agrawal
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Front Controller Pattern, i.e. all your request go to a common servlet with your desired URL pattern. Depending upon the value of some of your form parameter you can decide what response to send.

Also you can use iframe html tag inside your html response. It doesnt display the url address in the brower.

- Ashish Agrawal
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sounds awfully much like "I have this browser hijack I want to make to redirect people to my phishing scam without them noticing they're not really visiting eBay/Paypal/their bank".
 
Tina Desai
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I felt the requirement is like - keeping mysite.com/default.jsp in the adress bar all the time. Not to deny that someone is at www.mysite.com

Is it?

Tina
 
James West
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cathy,

Shankar is correct.

In the below, replace "<" with a less than symbol, and ">" with a greater than symbol, and in "on Click" remove the space.

If you are confused, let me try to explain. After you have created your servlet and the web.xml mapping:

You can either set the action in the hidden field directly, or set it in a javascript.
Using javascipt allows many different actions easily.


"<"input name='action' type='hidden' value='action1'">"
or:
"<"input name='action' type='hidden' value=''">"

"<"input type="button" name="myButton" value="Button 1" on Click="javascript:submitForm( 'action1' );"">"
"<"input type="button" name="myButton2" value="Button 2" on Click="javascript:submitForm( 'action2' );"">"
"<"input type="button" name="myButton3" value="Button 3" on Click="javascript:submitForm( 'action3' );"">"
"<"input type="button" name="myButton4" value="Button 4" on Click="javascript:submitForm( 'action4' );"">"

function submitForm( action )
{
document.forms[0].action.value = action;
document.forms[0].submit();
}


on the form, you simply do a post:
"<"form name='myForm' method='POST' action='[SERVLET_URL]'">"


Your servlet should act as a traffic cop and pass on the request. You can find the action easily in your java code:

String action = (String) request.getParameter( "action" );

In the above examples, the value of the String 'action' will either be "action1", "action2", "action3", or "action4".

There are many other variations, but hopefully this is a simple and straight-forward option.

- James
 
Cathy Cruise
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yes.. i think this will be easier for me to do. Thank you very much to all of you.. ^_^


cathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic