• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

when to use encodeURL()

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read that encodeURL() method helps in passing the session details back to server (i.e to keep the session based conversion alive) and it could be used when cookies are not available or disabled...
so i trying to find when actual it is used and why??
Could any give an example when it is used???
 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

so i trying to find when actual it is used and why??


we use url rewriting or cookies to maintain session across web server and browser because they talk using HTTP protocol which is a stateless protocol.Due to stateless nature of http protocol server never recognizes any client(browser) whether it has contacted him previously.so we need to maintain unique identifier in between them.Thats when session managment comes into picture.

when cookies are not available or disabled...



Normally session id is stored in cookie and browser will send that every time it makes request to server.In case if cookie is disabled.and you are not using url rewriting .It is not possible for the web server to recognize the client whether client is requesting first time or already in conversation. So we use url rewriting to generate the urls in the dynamic pages that means we append jsessionid in the url itself so when client submit the request server will get the session id from the url.

Could any give an example when it is used???



 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example given by Raj is absolutely valid, but generally the c:out tag is used in JSPs to encode any URLs with the JSESSIONID value (i.e. the backup to maintain session if cookies are disabled). Generally the encodeURL method is used in servlets i.e. servlets that generate HTML output as servlets don't have c:out tags, so this is their only options...
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ankit Garg wrote:but generally the c:out tag is used in JSPs to encode any URLs



All true, except it's the c:url tag. I'm sure that's what you meant ;-)
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit,
I would like to clarify on <c: out> or <c:url> . Which one of these is used for url rewriting???
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

chandan kumar mitwaa wrote:Ankit,
I would like to clarify on <c: out> or <c:url> . Which one of these is used for url rewriting???


You can trust Tomasz on that one.
 
chandan kumar mitwaa
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's ok Christophe.

Just 10 seconds gap between the two messages. I knew.
 
Ankit Garg
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya so I screwed up, this happens when there are background threads running in my mind (and they are a lot in quantity) :-) ...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I didn't notice that you almost posted at the same time.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Its c:url, c:out is used to print out something on the page.
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic