SlideShare une entreprise Scribd logo
1  sur  4
AdminUsers Module – Changesin Web-Layerto use Spring MVC
Overview
In this module following functions willbe coveredinREL.
1. Show Users List
2. Add New User
3. Edit Existing User
4. Save Changespost Editing
5. Delete Existing User
Module functions in Sample Application:
The users module inthe sample applicationwill support the followingfunctions exposedbythe listed URLs.
# URL Method Description
1
/admin/users/view/{id}
/admin/users/view
GET
Gets the list of users inthis
REL application
2 /admin/users/new GET
Shows the UI to adda new
user.
3 /admin/users/edit/{id} GET
Show the UI to edit the
info of existing user.
4 /admin/users/delete/{id} POST Deletes the existing user.
5 /admin/users/save POST
Saves the informationof
new andexisting user.
Controller – UserController.java
Create a newfile 'web/ UserController.java'. This class handlesthe "/adminUsers/*" requests.
package com.pearson.rel.webapp.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.pearson.rel.model.User;
@Controller
@RequestMapping(value="/adminUsers")
public classUsersController {
@RequestMapping(value="/view",method= RequestMethod.GET)
public String view(User user) {
return "userList";
}
@RequestMapping(value="/addNew",method= RequestMethod.GET)
public String addNew(Modelmodel,User user) {
return "userForm";
}
@RequestMapping(value="/edit/{userName}",method= RequestMethod.GET)
public String edit(Model model,User user){
model.addAttribute("userForm",new User());
return "userForm";
}
@RequestMapping(value="/delete",method = RequestMethod.POST)
public String delete(Model model,User user){
return "userList";
}
@RequestMapping(value="/save",method= RequestMethod.POST)
public String save(Modelmodel,User user) {
return "userForm";
}
}
Models & Services
(1) Model: Due to simplicityof requests, noadditional model needs to be added.
(2) Service: No changesat the servicesare required.
Subtasks
(1) Validations :
a. To check User withthe same name alreadyexists
b. To validate the “password” and“confirm password” fields match.
c. Validate mandatoryfields.
New functionality - Bulk Import from Spreadsheet
Overview:
Bulk Import from SpreadSheet: New linkwill be providedadjacent to “Addnew User” onview page. Using this link ,user can
import multiple admin users from XLS. After performing the validations, users would be addedto the database.
Steps Involved:
1. After clickingon link “BulkImport from SpreadSheet ” a newpage willget openas follows:
2. On UploadSpreadsheet : Uploaded data from XLS will be shown inJquerydata-gridas shownbelow:
3. After all the validations are validated, onclick of “Save” buttonnew adminusers will be savedin “appUser” table in
Relational database.
4. After saving indatabase, updatedstatus of the user will be shownas follows:
Module Functions:
# URL Method Description
1 /adminUsers/downloadTemplate GET
Downloads a newXLS
template to enter the user
records
2 /adminUsers/uploadSpreadSheet POST
Uploads the XLS file and
show the records inData
Grid on UI.
3 /adminUsers/saveAllUsers POST
Saves allthe validated
users in datatbase.
4 /adminUsers/editSheetUser POST
Edits the selecteduser in
the data grid.
5 /adminUsers/deleteSheetUser POST
Deletes the selecteduser
from the grid
Controller Changes – UserController.java
New functions will be added in UserController to achieve the above functionality is as follows:
@RequestMapping(value="/downloadTemplate",method= RequestMethod.GET)
public String downloadTemplate(Model model,User user) {
return "downloadTemplate";
}
@RequestMapping(value="/uploadSpreadSheet",method= RequestMethod.POST)
public String uploadSpreadSheet(Model model,User user) {
return "jsonView";
}
@RequestMapping(value="/saveAllUsers",method= RequestMethod.POST)
public String saveAllUsers(Model model,User user) {
return "successUsers";
}
@RequestMapping(value="/editSheetUser",method= RequestMethod.POST)
public String editSheetUser(Model model,User user) {
return "jsonView";
}
@RequestMapping(value="/deleteSheetUser",method= RequestMethod.POST)
public String deleteSheetUser(Model model,User user) {
return "jsonView";
}
Models & Services
(1) Model: No additionalmodel needs to be added.
(2) Service: Service that requires modification: service/UserManager.java.
(3) Helper: A new Helper class that needs to be added:web/BulkImportUserHelper”.

Contenu connexe

En vedette

En vedette (9)

Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Rest services caching
Rest services cachingRest services caching
Rest services caching
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 
Caching in HTTP
Caching in HTTPCaching in HTTP
Caching in HTTP
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)
 
Proxy Design Pattern
Proxy Design PatternProxy Design Pattern
Proxy Design Pattern
 

Similaire à User module

LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
Akhil Mittal
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
helpido9
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
niraj57
 
Student_result_management_system_project.doc
Student_result_management_system_project.docStudent_result_management_system_project.doc
Student_result_management_system_project.doc
AnshChhabra6
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
Trọng Huỳnh
 
10 Howto Administer Docpublisher
10 Howto Administer Docpublisher10 Howto Administer Docpublisher
10 Howto Administer Docpublisher
SWING Software
 
FABEX DOCUMENTATION
FABEX DOCUMENTATIONFABEX DOCUMENTATION
FABEX DOCUMENTATION
Jacob Wunude
 

Similaire à User module (20)

LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
 
ASP.NET Identity
ASP.NET IdentityASP.NET Identity
ASP.NET Identity
 
359555069 aae-control room-usermanual
359555069 aae-control room-usermanual359555069 aae-control room-usermanual
359555069 aae-control room-usermanual
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Task scheduling in laravel 8 tutorial
Task scheduling in laravel 8 tutorialTask scheduling in laravel 8 tutorial
Task scheduling in laravel 8 tutorial
 
Devise and Rails
Devise and RailsDevise and Rails
Devise and Rails
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Mvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaMvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senja
 
Student_result_management_system_project.doc
Student_result_management_system_project.docStudent_result_management_system_project.doc
Student_result_management_system_project.doc
 
M2ModuleDevelopmenteBook
M2ModuleDevelopmenteBookM2ModuleDevelopmenteBook
M2ModuleDevelopmenteBook
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 
Migration of application schema to windows azure
Migration of application schema to windows azureMigration of application schema to windows azure
Migration of application schema to windows azure
 
Phase 2
Phase 2Phase 2
Phase 2
 
10 Howto Administer Docpublisher
10 Howto Administer Docpublisher10 Howto Administer Docpublisher
10 Howto Administer Docpublisher
 
FABEX DOCUMENTATION
FABEX DOCUMENTATIONFABEX DOCUMENTATION
FABEX DOCUMENTATION
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

User module

  • 1. AdminUsers Module – Changesin Web-Layerto use Spring MVC Overview In this module following functions willbe coveredinREL. 1. Show Users List 2. Add New User 3. Edit Existing User 4. Save Changespost Editing 5. Delete Existing User Module functions in Sample Application: The users module inthe sample applicationwill support the followingfunctions exposedbythe listed URLs. # URL Method Description 1 /admin/users/view/{id} /admin/users/view GET Gets the list of users inthis REL application 2 /admin/users/new GET Shows the UI to adda new user. 3 /admin/users/edit/{id} GET Show the UI to edit the info of existing user. 4 /admin/users/delete/{id} POST Deletes the existing user. 5 /admin/users/save POST Saves the informationof new andexisting user. Controller – UserController.java Create a newfile 'web/ UserController.java'. This class handlesthe "/adminUsers/*" requests. package com.pearson.rel.webapp.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.pearson.rel.model.User; @Controller @RequestMapping(value="/adminUsers") public classUsersController { @RequestMapping(value="/view",method= RequestMethod.GET) public String view(User user) { return "userList"; } @RequestMapping(value="/addNew",method= RequestMethod.GET) public String addNew(Modelmodel,User user) { return "userForm"; } @RequestMapping(value="/edit/{userName}",method= RequestMethod.GET) public String edit(Model model,User user){ model.addAttribute("userForm",new User()); return "userForm"; }
  • 2. @RequestMapping(value="/delete",method = RequestMethod.POST) public String delete(Model model,User user){ return "userList"; } @RequestMapping(value="/save",method= RequestMethod.POST) public String save(Modelmodel,User user) { return "userForm"; } } Models & Services (1) Model: Due to simplicityof requests, noadditional model needs to be added. (2) Service: No changesat the servicesare required. Subtasks (1) Validations : a. To check User withthe same name alreadyexists b. To validate the “password” and“confirm password” fields match. c. Validate mandatoryfields. New functionality - Bulk Import from Spreadsheet Overview: Bulk Import from SpreadSheet: New linkwill be providedadjacent to “Addnew User” onview page. Using this link ,user can import multiple admin users from XLS. After performing the validations, users would be addedto the database. Steps Involved: 1. After clickingon link “BulkImport from SpreadSheet ” a newpage willget openas follows: 2. On UploadSpreadsheet : Uploaded data from XLS will be shown inJquerydata-gridas shownbelow:
  • 3. 3. After all the validations are validated, onclick of “Save” buttonnew adminusers will be savedin “appUser” table in Relational database. 4. After saving indatabase, updatedstatus of the user will be shownas follows: Module Functions: # URL Method Description 1 /adminUsers/downloadTemplate GET Downloads a newXLS template to enter the user records 2 /adminUsers/uploadSpreadSheet POST Uploads the XLS file and show the records inData Grid on UI. 3 /adminUsers/saveAllUsers POST Saves allthe validated users in datatbase. 4 /adminUsers/editSheetUser POST Edits the selecteduser in the data grid. 5 /adminUsers/deleteSheetUser POST Deletes the selecteduser from the grid Controller Changes – UserController.java New functions will be added in UserController to achieve the above functionality is as follows: @RequestMapping(value="/downloadTemplate",method= RequestMethod.GET) public String downloadTemplate(Model model,User user) { return "downloadTemplate"; } @RequestMapping(value="/uploadSpreadSheet",method= RequestMethod.POST) public String uploadSpreadSheet(Model model,User user) { return "jsonView"; } @RequestMapping(value="/saveAllUsers",method= RequestMethod.POST) public String saveAllUsers(Model model,User user) {
  • 4. return "successUsers"; } @RequestMapping(value="/editSheetUser",method= RequestMethod.POST) public String editSheetUser(Model model,User user) { return "jsonView"; } @RequestMapping(value="/deleteSheetUser",method= RequestMethod.POST) public String deleteSheetUser(Model model,User user) { return "jsonView"; } Models & Services (1) Model: No additionalmodel needs to be added. (2) Service: Service that requires modification: service/UserManager.java. (3) Helper: A new Helper class that needs to be added:web/BulkImportUserHelper”.