Summary Make a shopping cart using sessions for storage! This is easy stuff now that you've...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Summary Make a shopping cart using sessions for storage! This is easy stuff now that you've seen it done! Spend some time and make it amazing when it works! Exercises Start with the storage. Create a Phone POJO capable of storing an id, a phone model, and a phone price. Lombok as needed. Create an index.html page where you display list from a session attribute representing any phones you hope to purchase. You know enough now to pull this off on your own! Remember, ${session. ...} to retrieve attributes from a session! Create a form on index.html bound to a phone (model) attribute. Your users should be able to easily enter info here about what they hope to purchase. Post from your form back to "/insertPhone" and use a ModelAttribute to retrieve your form data in a pre- populated Phone instance. In the "/insertPhone" mapped method, create an empty List<Phone>. Check if your session isNew(). If it is new, initialize the list of phones so we can store future info in it! If the session is not new, get a (the?) list of phones you stored last time (coming up in a sec) out of it. Either way (new session or old), add the current info your user wishes to purchase to the list, then add the list to the session as an attribute again! Finish it off with a blank Phone in the model again so you can add another at your form! Things to watch for: This algorithm needs to line up with itself exactly in many of the same ways Spring does! If you create a varable phoneList, you must initialize a variable called phoneList or get an attribute and set your phoneList var equal to it. Similarly, the attribute name you get for your phoneList must exactly equal the attribute name you set for it a moment later if this is to work! Summary Make a shopping cart using sessions for storage! This is easy stuff now that you've seen it done! Spend some time and make it amazing when it works! Exercises Start with the storage. Create a Phone POJO capable of storing an id, a phone model, and a phone price. Lombok as needed. Create an index.html page where you display list from a session attribute representing any phones you hope to purchase. You know enough now to pull this off on your own! Remember, ${session. ...} to retrieve attributes from a session! Create a form on index.html bound to a phone (model) attribute. Your users should be able to easily enter info here about what they hope to purchase. Post from your form back to "/insertPhone" and use a ModelAttribute to retrieve your form data in a pre- populated Phone instance. In the "/insertPhone" mapped method, create an empty List<Phone>. Check if your session isNew(). If it is new, initialize the list of phones so we can store future info in it! If the session is not new, get a (the?) list of phones you stored last time (coming up in a sec) out of it. Either way (new session or old), add the current info your user wishes to purchase to the list, then add the list to the session as an attribute again! Finish it off with a blank Phone in the model again so you can add another at your form! Things to watch for: This algorithm needs to line up with itself exactly in many of the same ways Spring does! If you create a varable phoneList, you must initialize a variable called phoneList or get an attribute and set your phoneList var equal to it. Similarly, the attribute name you get for your phoneList must exactly equal the attribute name you set for it a moment later if this is to work!
Expert Answer:
Answer rating: 100% (QA)
Create Phone POJO using Lombok import lombokData Data public class Phone private Long id private Str... View the full answer
Related Book For
Management Leading And Collaborating In The Competitive World
ISBN: 9780078137242
9th Edition
Authors: Thomas Bateman, Scott Snell
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Write a project management plan. we have a template and project description. we need to edit the template(table of contents) with our own ideas. CPSC 8820-01 Project Management Plan Your Unique...
-
A money market portfolio has a market value of $20,000,000 and its value will change by $500 for a change in short-term yields of one basis point. The eurodollar futures contract has a tick size of...
-
Telly, age 38, has a $140,000 IRA with Blue Mutual Fund. He has read good things about the management of Green Mutual Fund, so he opens a Green Fund IRA. Telly asked for and received his balance from...
-
Graph each equation in Exercises 1328. Let x = -3, -2, -1, 0, 1, 2, and 3. y = |x| = 1
-
What are the different types of schemes associated with complex frauds?
-
Even though independent gasoline stations have been having a difficult time, Susan Solomon has been thinking about starting her own independent gasoline station. Susan's problem is to decide how...
-
produce a reflective comparison of China and the U.S. in terms of social/political/economic systems. Given the focus of this course and this particular module, what is the fundamental basis for the...
-
I already completed for my first payment a week ago but why I can't use it anymore?
-
Popping Pops makes two types of popcorn. There is limited time available in the popper. The Cheddar version takes 0.40 hours per bag, while the Caramel takes 0.20 per bag. Information about the...
-
Learn to build a basic business case by using data analysis techniques and interpreting and presenting their results. Techniques include weighted values, NPV calculation and comparison, sensitivity...
-
Credit Card B (For Clothes) $ 5,000 Nate's Student Loan Balance (Federal) $55,000 Cash on Hand $ 1,200 Personal Property $ 3,000 Credit Card D (For Misc. Items) $ 2,100 Nate's - Car Loan Balance...
-
At the beginning of the month, Supplies were $500. During the month, the company purchased $400 of supplies. At month's end, November 30, $300 of supplies were still on hand. a. What was the cost of...
-
Which side of the t - square is a business account? Explain.
-
The following data pertain to a Kaplan turbine : Power available at shaft = 8850 kW; net available head = 5.5 m; speed ratio = 2.1; flow ratio = 0.67, overall efficiency = 85%. Assuming that hub...
-
Why can wastewater treatment requirements in Hawaii be less stringent than those in most locations on the U.S. mainland?
-
The chapter opened with a quote by GEs Jack Welch: Manage your destiny, or somebody else will. What does this mean for strategic management? What does it mean when Welch adds, .or somebody else will?
-
If you had entered into a joint venture with a foreign company, but knew that women were not treated fairly in the culture, would you consider sending a female expatriate to handle the startup? Why...
-
This is a case about unions. This case involves one of the divisions of the workforce of a state university near you. The personnel of that university are structured like many others around the...
-
Provide an overview of the behavioral finance perspectives of risk.
-
Define the heuristic biases of representativeness, anchoring, and mental accounting.
-
List and explain some fundamental issues of behavioral finance.
Study smarter with the SolutionInn App