Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not encoding the URLs

 
John Paterson
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys...

How do I modify a URL encoding code to one that doses not encode the URL? For an example, how do I modify the following line of code such that it does not encode the URL:



Hope someone can advise. Thanks.

regards
John
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to do that? The JavaDocs for encodeURL say:

For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, you should no longer be using Java scriptlets in JSP pages. Please read this JspFaq entry.

Secondly, if you don't want the URL encoded, why are you calling the encoding method?
 
John Paterson
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys...


I underand that using scriplets may not be 'best practice' anymore. I am picking up Servlets and JSPs, one of the exericies I was doing required me to do the above and I wasn't sure how to do it, hence the post. I thought since I am learning, I should get a hang of how these things are done, even though such a procedure may not be common practice anymore. Thanks.

regards
John
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can never understand the attitude of "I'm just learning, so I'm going to learn how to do it wrong first."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic