This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to bring variable from previous session to next session Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

how to bring variable from previous session to next session

Megha Singhal
Ranch Hand

Joined: Feb 28, 2012
Posts: 128

my jsp form is like that there is table having edit and delete option in each row
so when i click on edit button
through following it take me to the servlet with the help of P_id variable which is unique in my database and it should redirect me to the jsp page

function editRecord(P_ID){

window.location.href="../edit/UserServlet?"+P_ID;
}

following is my servlet code


but it is not redirecting to the jsp page i tried to check the code but putting out.println on various places then i find that due that session it is not working because if i am passing any particular value of P_ID then it is working
here i am using following

String str = request.getQueryString();
int P_ID = Integer.parseInt(str);

as in session string can be passed but P_ID is integer type so i have to do typecasting but i think it is not taking that but this session is working in my delete code so i used in this also. i am not getting why this is not working in my edit code.

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8439

Please do not post, essentially the same question, multiple times.
Let us continue the discussion in your original topic here http://www.coderanch.com/t/571694/Servlets/java/exception-while-running-code

[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to bring variable from previous session to next session
 
Similar Threads
exception while running code
page gets hang on runtime
Exception coming while connecting to database
error of missing values
not redirecting to main page