Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes decoding URL values 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 "decoding URL values" Watch "decoding URL values" New topic
Author

decoding URL values

Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All,

I have a servlet which receives data

for example :

I have the following questions
Q1 : Is it possible to save the received data as it is , for above example , i want to data save as in database

Q2 : How to decode above Data to its original string ?

[Edit by Bear: added more descriptive subject]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Suresh Khant wrote:
Q1 : Is it possible to save the received data as it is , for above example , i want to data save as in database

Why? That doesn't seem like a reasonable thing to do.

In any case, the value will be automatically decoded by getParameter(). You can re-encode it, if you wish, with java.net.URLEncoder.

Q2 : How to decode above Data to its original string ?

As I said, this will happened automatically.

In general, to decode use java.net.URLDecoder.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Thanks for your reply,

I have used the UrlDecoder



but getting squares




Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Well, of course you are. What did you expect to get from %06?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: decoding URL values
 
Similar Threads
[javamail] Error with encoding
URLyBird 24hr booking rule for comment
please solve this prob
javax.xml.ws.WebServiceException: Failed to access the WSDL
Convert Into Java Code.