?
Solved

Encode in Java

Posted on 2011-09-13
13
Medium Priority
?
223 Views
Last Modified: 2012-05-12
Hello Experts,

I need to encode  URL :  url="SummaryPage.do?Id=-1&qType=quote";   in JAVA.

Currently showing like:

http://localhost:****/SummaryPage.do?Id=-1&qType=quote

The result should be like:

http://localhost:****/SummaryPage.do?quote


And also how to decode it.

0
Comment
Question by:Swadhin Ray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 16

Author Comment

by:Swadhin Ray
ID: 36530005
It would be great if some one can give me some sample code to test ...
0
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 total points
ID: 36530704
I am not sure waht you mean but look at the code at accepted siolution here, maybe it will help:
http://stackoverflow.com/questions/724043/http-url-address-encoding-in-java



0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36530757
You really need to look into what URL encoding means. Your two examples do not relate to each other, and at a quick glance, the first one doesn't need encoding
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 16

Author Comment

by:Swadhin Ray
ID: 36531245
My java code is something like below:

 url="SummaryPage.do?Id=-1&qType=quote";


Now when I open the main URL it will be like :

http://localhost:<<port>>

When I click on summary page button it redirect me to another page and the URL looks like :

http://localhost:<<port>>/SummaryPage.do?Id=-1&qType=quote


Where I want to encode the below:

http://localhost:****/SummaryPage.do?quote

So that I dont have to show the user the ID number and the type of request type.


Can any give me the example on my requirement.  





0
 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 1000 total points
ID: 36531541
use hidden fileds and set the values dont pass the values in URL this is simple way
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36531612
Maybe you can use the POST method then it will not
pass the vlaues thriough the address line
0
 
LVL 16

Author Comment

by:Swadhin Ray
ID: 36533258
@yan .. can you give me some example on values that I have provided?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36533272
You use the form with hidden elements and in its action you specify method=POST
and for hidden element you specify their names Id and qType and their
values -1 and quote respectively and when you submit such form and
say in the servlet specified in the action method you'll retrieve
your values the same way as you would retrieve them from the
GET method if they were present in the address line
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36533316


This shows an example how to pass parameters in the hidden fileds
of the form:
http://www.roseindia.net/jsp/jspsession/HiddenForm.shtml
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 36534069
@yan : why ur repating my answer ?????
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36534847
A combination of http:#36531541 and http:#36531612 should do it for you. Nothing to do with encoding btw - you mean you want to hide the parameters
0
 
LVL 16

Author Comment

by:Swadhin Ray
ID: 36535547
Yes..
0
 
LVL 16

Author Closing Comment

by:Swadhin Ray
ID: 36548399
This really helped me.. thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question