This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Adding Attributes to Servlet Link?" Watch "Adding Attributes to Servlet Link?" New topic
Author

Adding Attributes to Servlet Link?

Kimberley Jones
Greenhorn

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.

Jules
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
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.
Bill
Kimberley Jones
Greenhorn

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
How to hide the jsessionid id in my address bar in servlet programming
Order of parameters with Tomcat
RequestDispatcher display the servlet URL, not the jsp