wood burning stoves 2.0*
The moose likes Servlets and the fly likes Adding Attributes to Servlet Link? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Adding Attributes to Servlet Link?" Watch "Adding Attributes to Servlet Link?" New topic

Adding Attributes to Servlet Link?

Kimberley Jones

Joined: Sep 09, 2004
Posts: 7
I am working on a web-based app. I am trying to avoid showing my parameters in the address bar. Is there any way to link to a servlet using <a href="Example"> and have Example pick up some parameters?

Is submitting a form the only way a servlet can get parameters without showing your params in the address bar?

Thanks in advance for any help/ideas.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
yeah we can't say like,

<a href="SomeLogger" method="post"> logger </a>

hope somebody knows and comes up with a solution.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
couldn't we use a hidden field. check that field on the server side and then use forward() or sendRedirect(). but ofcourse this is the other way out.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Kimberley,

If you don't mind using JavaScript you could always submit a form with code like the following:

If you want to make your URL parameters inaccessible you need to avoid using HTTP GET.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
If you absolutely have to use GET - consider encrypting the added attributes - they will be visible but not understandable. Look at some of the SPAM email messages you get - if they contain URLs with long chunks of gibberish - that may be encrypted attributes.
Kimberley Jones

Joined: Sep 09, 2004
Posts: 7
I will look into both the form and the encrypted attributes ideas...I feel like I've probably seen a lot of encrypted attributes at e-mail and e-commerce sites.

Thanks so much for your help.
I agree. Here's the link: http://aspose.com/file-tools
subject: Adding Attributes to Servlet Link?
Similar Threads
Adding Custom Data to Response Headers?
'POST'ing parameters to another JSP
RequestDispatcher display the servlet URL, not the jsp
How to hide the jsessionid id in my address bar in servlet programming
Order of parameters with Tomcat