wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes We should encode each link in our application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "We should encode each link in our application" Watch "We should encode each link in our application" New topic
Author

We should encode each link in our application

Abhishek KumarSoni
Ranch Hand

Joined: Nov 05, 2013
Posts: 61

During my reading of session management from Head First JSP & Servlet I found that there are two ways of session management.One is By help of cookies In case If client has not enabled it then URL rewriting is substitute.It means that while developing a web app we should encode each and every link.Because we at time of development even after development we are not aware of fact that whether our client will enable cookie or not So as alternate we should encode each link by
using <code>response.encodeURL()</code>
method .Is this true?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

If you care about working in environments where people disable cookies, then yes. Personally, I choose not to: anyone who disables cookies or JavaScript does not use my web applications.

So as with most things, the answer is: it depends.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

P.S. In a JSP you would use <c:url>, not Java code,
Abhishek KumarSoni
Ranch Hand

Joined: Nov 05, 2013
Posts: 61

Bear Bibeault wrote:P.S. In a JSP you would use <c:url>, not Java code,

Its mean most of the website like google or microsoft encodes their URL because they work on global level where people may have disable their cookies
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: We should encode each link in our application