File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Not encoding the URLs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Not encoding the URLs" Watch "Not encoding the URLs" New topic
Author

Not encoding the URLs

John Paterson
Ranch Hand

Joined: Mar 12, 2012
Posts: 133
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

Joined: Feb 26, 2001
Posts: 5270
    
  10

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Paterson
Ranch Hand

Joined: Mar 12, 2012
Posts: 133
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

Joined: Jan 10, 2002
Posts: 61760
    
  67

I can never understand the attitude of "I'm just learning, so I'm going to learn how to do it wrong first."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not encoding the URLs