Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Management using encodeURL()

 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I was going through session management using encodeURL()
I have doubt regarding encodeURL
scenario:-
I have a login page where the user enters his name and password and in its action attribute I have used encodeurl() and the parameter I passed is the target servlet's name.
In the target servlet I am just dispatching the request to a jsp where I am asking the user to add some additional info about him after displaying
what he has entered in the first page.

Do I need to obtain a session(using getsession()) and use encodeurl in the servlet and pass the jsp to be hit as parameter or I have to get the id(getId())after getting the session object and write something like the undermentioned code in the servlet:-


Thanks,
Abhisek
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need not append the sessionid, encodeURL() will do it for you.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!