aspose file tools
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


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: 133

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: 8566

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
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