Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 21 Create a User Admin application In this exercise, youll create an application that allows you to view all users, update existing users, and

Exercise 21 Create a User Admin application

In this exercise, youll create an application that allows you to view all users, update existing users, and delete users in the User table of the murach database. Review the code

Download and open the project named ch12_userAdmin.

Review the Java code for this application. Note that the UsersServlet and UserDB classes arent finished.

Review the configuration files for this application. Note that the context.xml file configures connection pooling and that the web.xml file maps the servlet to a URL.

Add code to display the users

Open the UserDB class thats located in the murach.data package. Then add code to the selectUsers method to return an ArrayList of User objects that corresponds with the rows in the User table.

Open the UsersServlet class and add code to the display_users action that gets an ArrayList of User objects from the User table, sets that list as a request attribute, and forwards the request to the index.jsp file.

Run the application to make sure it works correctly for the display_users action

Add code to update a user

Open the index.jsp file. Note that the Update and Delete links request the UsersServlet and pass an action parameter to it to specify the action and an email address to specify the user.

Open the UsersServlet class and add code for the display_user action that gets the User object for the specified email, stores this object in the request, and forwards the request to the user.jsp file. This should display the user.

Open the user.jsp file. Note that it displays user data and submits it to the UsersServlet class with an action that specifies that the user should be updated.

Network-Based Application Development (ITIS 4166) Fall 2017

10. Open the UsersServlet class and add code to the update_user action that updates the first and last name of the user in the User table. This servlet should forward the request to the UsersServlet so it displays the current users.

11. Run the application to make sure it works correctly for the update_user action. Add code that deletes a user

Open the UsersServlet class and add code to the delete_user action that deletes the specified user. This servlet should forward the request to the UsersServlet so it displays the current users.

Run the application to make sure it works correctly. You shouldnt be able to delete any users that have related rows in the Download table. This includes the three users added as part of the database creation scripts. However, you should be able to delete any users that you add with the ch12email application.

Download Program Files From ZIP: https://drive.google.com/file/d/0B5HjVVkWJYBIdGNGcVpTdGQ3Slk/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

Step: 3

blur-text-image

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions