This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Joined: Nov 04, 2000
hi Dave why i am not using session variable is because.. I have to link an account with a customer So i search for a account- search for a customer display both the details side by side in the link screen (acc1, cust1). When i click on "link" these two are linked. so till this point the account and customers are in my session now suppose before clicking "link" the user goes back to search the account and customer (This is not by clicking the browser back but by the navigation link which is to be provided on the top of the page) So again after searching for the account and the customer, he comes to the link page (again acc2 and cust2 are in my session). But again the user thinks somthing and using the browser back button he goes back the the previous link screen where he is shown the acc1 and cust 1 details and he says "link". He sits happily thinking he has linked acc1 and cust 1 but when he get compalins that the account is not linked he is confused, checks in the database then he finds that acc1 and cust 1 are not linked instead acc2 and cust 2 are linked as these were the data in the session when he pressed "link". So i feel i have only the option of using doPost, or doGet. With doGet having the details on the address bar its better to use doPost ??? regards, Anil
you can use a different encoding for the hidden fields. Simply using a base64 encoding may suffice for typical users. Or you can put a key in the hidden fields and use that key to retrive different set of values from session.
tobe bondhu nouka bherao<br />shonabo gaan aj shara raat
I think part of the problem is that when some screens are generated, you don't know what the user has been doing. You could record state information in the session, making an entry for each page displayed. When making a new page, you could make a decision based on the history. You could even display the user's history (possibly a "breadcrumbs" like display?) There is a design pattern called (I think) the command pattern where the state information saved is enough to roll back (undo) the actions so as to arrive at an earlier condition. It is an interesting problem - let us know how you solve it.... Bill
Joined: Nov 04, 2000
hi zakaria you can use a different encoding for the hidden fields. Simply using a base64 encoding may suffice for typical users. How can i do this ?? Or you can put a key in the hidden fields and use that key to retrive different set of values from session. using this i suppose i would overload the session. As i have to put all the visited page values into the session.. Regards Anil
Author and all-around good cowpoke
Joined: Mar 22, 2000
Don't worry about "overloading" a session, there is no limit except available memory on session contents, and if all the contents are serializable, some servlet engines will store sessions to disk. Naturally good design would require cleaning up all the stored objects when they are not needed anymore. Bill