This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I am working on a J2EE Project with JSP, EJB and Servlets. I have a requirement which requires me to throw a warning message when a user changes some values in a screen and tries to go out of the screen without saving it. There is a catch here. I have implemented the left menu bar in a separate JSP and have included it in every other screens. So if the user modifies any of the screen values and then clicks the left menu bar, how will I be able to track the changes made in the screen values? If any of you have any suggestions, please help me out. Thank you in advance.
You could also use the onBeforeUnload handler of the page body (might be named slightly differently), which will be invoked before a page gets replaced. From inside it you can prevent a new page from being loaded if necessary. But you'd still need to keep track of altered fields, as suggested above.