Reputation: 393
In my jsp page I have a link:
<a href="adminView.do?profile=all">Clear</a>
If I click the link in the browser address bar I can see:
adminView.do?profile=all
instead of
adminView.do
How to hide passed request parameters from the user?
Upvotes: 0
Views: 2600
Reputation: 1464
In order hide the parameters you must use a form and post the data. You can't just use an <a>
tag. You can still pull off the look you are going for with a form. Just put the form tags around your anchor tag:
<form id="postRequest" action="adminView.do" method="post" target="_blank">
<input type="hidden" name="profile" value="all"/>
<a href="#" onclick="document.getElementById('postRequest').submit()">Clear</a>
</form>
Here is a helpful link about sending and retrieving form data.
And here is a JSFiddle to show what the URL looks like when submitting a form using post vs get.
Upvotes: 1
Reputation: 317
If you want to hide parameters from users, you will have to use post request. In your href call a method to generate post request and then send it.
Upvotes: 1