File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes about  URLEncoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "about  URLEncoding" Watch "about  URLEncoding" New topic

about URLEncoding

ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 196
Hi ,

As per my knowledge,when we submit a form then based on ENCTYPE attribute application/x-www-form-urlencoded or multipart/form-data is used by the browser to encode the form data.
But i have seen on some jsp pages that the value of input variables are explicitly being encoded using URLEncoder.Then on server side they are decoded using URLDecoder.What is the reason behind this?
Please let me know.

Greg A Watson

Joined: Mar 28, 2006
Posts: 6
Sounds like an approach to counter Cross Site Scripting attacks.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Special characters must be encoded if they are going to be part of the URL. When this isn;t being done by a form submission, it must be done "by hand".

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: about URLEncoding
It's not a secret anymore!