This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

decoding URL values

 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply,

I have used the UrlDecoder



but getting squares




 
Paul Clapham
Sheriff
Pie
Posts: 20759
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, of course you are. What did you expect to get from %06?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic