File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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: 170
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: 41839
    
  63
You should use POST instead of GET, and make those parameters hidden input fields.


Ping & DNS - my free Android networking tools app
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
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: 41839
    
  63
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