This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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: 63548

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]
subject: about URLEncoding
jQuery in Action, 3rd edition