aspose file tools*
The moose likes JSP and the fly likes How to hide the parameters shown in the url while submitting a form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to hide the parameters shown in the url while submitting a form" Watch "How to hide the parameters shown in the url while submitting a form" New topic
Author

How to hide the parameters shown in the url while submitting a form

vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 169
Hi all,

I have a form and have some values in the form ..



When the form is submitted in the address bar all these parameters are shown.Is there anyway to hide these parameters?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39543
    
  27
You should use POST instead of GET, and make those parameters hidden input fields.


Ping & DNS - updated with new look and Ping home screen widget
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 169
Hi,
My form is already using POST..
I cannot hide the parameter.. I have a common js script. Lots of pages are using this common script
In that I am doing this function..
CODE]
window.location=url;

[/CODE]
where url="welcome.do?"...ETC parameters following here

Thanks,
Usman Saeed
Ranch Hand

Joined: May 21, 2008
Posts: 31
Hi,
you can use HIDDEN input tag.
e.g


Usman Saeed
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39543
    
  27
Setting window.location is different from calling form.submit(). The former will always do a GET, while the latter -which is what the code you posted is doing- will use whatever the form's action attribute is set to.

The only way to keep parameters out of the URL is to use POST. So if that's the paramount requirement, then you'll need to adapt the code that's forcing you to do a GET.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to hide the parameters shown in the url while submitting a form
 
Similar Threads
multipart/form-data inputs
Multiple form with one action
setting target on a href
IE issue with setting action
Hiding parameters from URL