Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Session and cookies Orginal Program files are in this zip (you most click downlaod, no preview): https://drive.google.com/file/d/0B5HjVVkWJYBIV3hZTGR1UlJVYmM/view?usp=sharing Step 1: Storing data in Session Attention: In

Session and cookies

Orginal Program files are in this zip (you most click downlaod, no preview): https://drive.google.com/file/d/0B5HjVVkWJYBIV3hZTGR1UlJVYmM/view?usp=sharing

Step 1: Storing data in Session Attention: In this step, make sure that you use private browsing or delete your browsers cache 1. Modify MembershipControllerServlet class so that if someone requests to visit /[project_name]/membership?action=profile, she sees profile.jsp (the request should be redirected to profile.jsp) 2. *** Run the application, visit /[project_name]/membership?action=profile (with a browser). Take a screenshot from the browser. Question 1 a: Can you see the users profile? 3.***Visit/[project_name]/membership?action=signup,filltheform,andthen click submit. Take a screenshot from the output. Question 1 b: Can you see the users profile? 4. *** Again visit /[project_name]/membership?action=profile. Take a screenshot Question 1 c: Can you see the submitted form data in the profile page? 5. Instead of storing UserInfo object in request object in MembershipControllerServlet, store the UserInfo object in session object Hint: session.setAttribute(string key, object value) 6. Modify profile.jsp, instead of reading from request object, read from session object 7. Run the application 8. Visit /[project_name]/membership?action=signup, fill the form, and then click submit 9. *** Again visit /[project_name]/membership?action=profile. Take a screenshot Question 1 d: Can you see the users profile? Based on your observation in this step, justify your answers to question 1 a, 1 b, and 1 c. Step 2: Working with cookies In this step, we want to store some data on a cookie and work with it. 1. Modify signup.jsp and profile.jsp, the following line (links) must be on the top of these pages: Background color: White Red Blue Each of the links must point to membership?action=X&color=Y Where X can be profile or signup based on the location of the link. If the link is inside profile.jsp, X must be profile Where Y is white, red, blue based on the text of the link 2. Modify MembershipControllerServlet a) define the String variable pageColor. We will use this variable to change the color of the profile.jsp and signup.jsp b) Check whether color parameter exists in the query string. If it exists, make sure that it is not empty and let the value of pageColor be equal to the value of color parameter. Then define a cookie with the key backgroundColor and the value pageColor. Add the cookie to the response object. c) If color parameter does not exist or it is empty, the pageColor must be backgroundColor in the cookie. d) If backgroundColor does not exist, the pageColor must be white (white is the default color). e) Create an attribute in session by calling session.setAttribute(color, pageColor). 3. Modify profile.jsp Read the attribute in step 2.e, and set the background color of the page to that value. Hint: you can use EL to access the attribute

4. Modify signup.jsp Read the attribute in 2e, set the background color of the page to that value. 5. Run the application 6. *** Visit /[project_name]/membership?action=signup, click on blue. Take a screenshot. 7. *** Fill the form and click on Submit button. Take a screenshot. 8. Close the browser and reopen it. 9. Visit /[project_name]/membership?action=profile. Take a screenshot Question 2 a: What is the background color? Why? Question 2 b: Can you see the profile data? Why?

Orginal Program files are in this zip (you most click downlaod, no preview): https://drive.google.com/file/d/0B5HjVVkWJYBIV3hZTGR1UlJVYmM/view?usp=sharing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

8. Do the organizations fringe benefits reflect diversity?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago