Enhance the Future Value application to remember the amount andinterest rate
In this exercise, you’ll enhance the Future Value application tostore the amount and interest rate in the user’s session. That way,the user can experiment with different numbers of years to see thevalue of his or her investment without having to enter the amountand interest rate each time.
Review the project
Start NetBeans and open the project named ch07_ex3_futureValuethat is on
the Canvas page. You will have to unzip the file.
Open the index.jsp file. Note the JSTL if tags that display thevalues of the amount and interest attributes if they areavailable.
Open the result.jsp file. Note that a link has been added totake you back to the Calculator page.
Run the application, enter some values, click the Calculatebutton, and click the “Return to Calculator” link. On theCalculator page, all of the text boxes should be empty.
Modify the code
Open the FutureValueServlet class.
Add code to store the investment amount and interest rate in theuser’s session. For example, store the investment amount as anattribute named “amount” and the interest rate as an attributenamed “interest”.
Run the application again, enter some values, click theCalculate button, and click the “Return to Calculator” link. On theCalculator page, the Investment Amount and Yearly Interest Rateboxes should contain the values you entered.
Navigate to a different website. Then, return to the FutureValue application by entering the following URL in your browser’sURL box:
Since the values are stored in the session, the applicationshould remember them even though you left the Future Valueapplication and went to a different site.
Close your browser and restart it. Then, enter the above URL inyour browser’s URL box again. This time, the application should notremember your values. That’s because closing your browser endedyour previous session.
Files are here:https://drive.google.com/file/d/0B5HjVVkWJYBITWN2Z29BQ2ZiZnM/view?usp=sharing(download the zip file)