SlideShare ist ein Scribd-Unternehmen logo
1 von 20
CourseSites New User Profile
pages
Powered by SpringMVC 2.5
Goals
• Modernize the code-base from SpringMVC 2.0
to SpringMVC 2.5  with the end goal of
SpringMVC 3.0 in the future
• More engaging User experiences  drive
adoption (91 countries, 6000+ institutions )
Spring MVC 2.5
key concepts
• The importance of annotations
– @Controller (no more inheriting from
SimpleFormController, MultiActionController on
2.0 version)
– @ModelAttribute
– @SessionAttribute
General Architecture (Controller)
• @Controller
• @RequestMapping(value="/profile.form")
• @SessionAttributes("spring25UserVO")
• public class ProfileForm {
• ……
• ……
• }
General Architecture …(1)
• @RequestMapping(method =
RequestMethod.GET)
• public String setupForm(HttpServletRequest
request, HttpServletResponse response,
Model model) {
• …….
• }
General Architecture….(2)
• @RequestMapping(method =
RequestMethod.POST)
• public String processSubmit(HttpServletRequest
request, @ModelAttribute("spring25UserVO")
Spring25UserVO spring25UserVO,
• BindingResult result, SessionStatus status, Model
model) {
• ….
• }
Profile
Profile page
Model
in particular  wiring the Gender
• public class Spring25UserVO {
– private UserVO userVO;
• …….
• }
Model…(1)
• public class UserVO {
– private User user;
• ………..
• }
Model…(3)
• public class User {
• …….
• /**
• * Returns the gender of this <code>User</code> object.
• * <p>
• * Requires AttributePermission with name "user.personalinfo", actions "get".
• *
• * @return a gender value as defined in {@link User.Gender}
• * @see User.Gender
• */
• public User.Gender getGender()
• {
• if ( _checkPerms )
• {
• SecurityUtil.checkPermission( _getPersonalInfo );
• }
• return (User.Gender) _bbAttributes.getBbEnum( UserDef.GENDER );
• }
• ……
• }
Profile Controller
• @InitBinder
• public void initDataBinder(WebDataBinder
dataBinder)
• {
• dataBinder.registerCustomEditor(Gender.class,
new GenderEditor());
•
dataBinder.registerCustomEditor(EducationLevel.class,
new EducationEditor());
• }
Custom Editor
• public class GenderEditor extends PropertyEditorSupport {
– @Override
– public String getAsText() {
• // TODO Auto-generated method stub
• Gender value = (Gender) getValue();
• return value.toFieldName();
– }
– @Override
– public void setAsText(String text) throws IllegalArgumentException {
• // TODO Auto-generated method stub
• //super.setAsText(text);
• if (text.equalsIgnoreCase(Gender.FEMALE.toFieldName())) {
– setValue(Gender.FEMALE);
• }
• else if (text.equalsIgnoreCase(Gender.MALE.toFieldName())) {
– setValue(Gender.MALE);
• }
• else {
– setValue(Gender.UNKNOWN);
• }
– }
• }
Profile View/JSP
• <form:form id="profileForm"
name="NewUserProfileForm"
modelAttribute="spring25UserVO"
method="POST">
• ……
• </form:form>
Profile View/JSP
• <spring:message code="bb.userProfile.gender" var="gender">
</spring:message>
• <bbNG:dataElement label="${gender}" isRequired="false">
• <!-- the "path" element (gender) points to the
userVO.user.gender property
• so as long as the userVO.user.gender reflects the value from the
• DB (User.gender) such as "MALE"...this will be automatically
• "selected" as well -->
• <form:select path="userVO.user.gender" items="${genders}"/>
• </bbNG:dataElement>
Social Page
jQuery Dialog
Social Page
jQuery dialog
jQuery Dialog
• jQuery("#dialog").dialog({
• modal: true,
• bgiframe: true,
• width: 500,
• height: 200,
• autoOpen: false
• });
• jQuery("#confirmDeleteImage").dialog({
• modal: true,
• bgiframe: true,
• autoOpen: false });
jQuery Dialog …(cont)
• jQuery(".myavatar").click(function (e) {
• jQuery("#dialog").dialog({
• buttons : {
• "Update" : function() {
• window.location.href = "imageUpload.form";
• },
• "Delete" : function() {
• jQuery(this).dialog("close");
• jQuery('#confirmDeleteImage').dialog('option', 'buttons', {
• "No": function() { jQuery(this).dialog("close"); },
• "Yes": function() { window.location.href = "imageDelete.form"; }
• });
• jQuery('#confirmDeleteImage').dialog('open');
•
• },
• "Cancel" : function() {
• jQuery(this).dialog("close");
• }
• }
• });
• jQuery("#dialog").dialog("open");
• return false;
• });
Q&A
• Questions?! Comments?!

Weitere ähnliche Inhalte

Ähnlich wie Course sites new user profile pages

WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on Java
Max Titov
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
Dilip Patel
 

Ähnlich wie Course sites new user profile pages (20)

Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
Jersey
JerseyJersey
Jersey
 
Requery overview
Requery overviewRequery overview
Requery overview
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
WordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a Framework
 
The Spring Update
The Spring UpdateThe Spring Update
The Spring Update
 
Ajug - The Spring Update
Ajug - The Spring UpdateAjug - The Spring Update
Ajug - The Spring Update
 
Database Programming Techniques
Database Programming TechniquesDatabase Programming Techniques
Database Programming Techniques
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on Java
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
 
Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworks
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel
 
Backbone js
Backbone jsBackbone js
Backbone js
 
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
 
Backbone js-slides
Backbone js-slidesBackbone js-slides
Backbone js-slides
 
Resource Routing in ExpressionEngine
Resource Routing in ExpressionEngineResource Routing in ExpressionEngine
Resource Routing in ExpressionEngine
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

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?
 
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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

Course sites new user profile pages

  • 1. CourseSites New User Profile pages Powered by SpringMVC 2.5
  • 2. Goals • Modernize the code-base from SpringMVC 2.0 to SpringMVC 2.5  with the end goal of SpringMVC 3.0 in the future • More engaging User experiences  drive adoption (91 countries, 6000+ institutions )
  • 3. Spring MVC 2.5 key concepts • The importance of annotations – @Controller (no more inheriting from SimpleFormController, MultiActionController on 2.0 version) – @ModelAttribute – @SessionAttribute
  • 4. General Architecture (Controller) • @Controller • @RequestMapping(value="/profile.form") • @SessionAttributes("spring25UserVO") • public class ProfileForm { • …… • …… • }
  • 5. General Architecture …(1) • @RequestMapping(method = RequestMethod.GET) • public String setupForm(HttpServletRequest request, HttpServletResponse response, Model model) { • ……. • }
  • 6. General Architecture….(2) • @RequestMapping(method = RequestMethod.POST) • public String processSubmit(HttpServletRequest request, @ModelAttribute("spring25UserVO") Spring25UserVO spring25UserVO, • BindingResult result, SessionStatus status, Model model) { • …. • }
  • 9. Model in particular  wiring the Gender • public class Spring25UserVO { – private UserVO userVO; • ……. • }
  • 10. Model…(1) • public class UserVO { – private User user; • ……….. • }
  • 11. Model…(3) • public class User { • ……. • /** • * Returns the gender of this <code>User</code> object. • * <p> • * Requires AttributePermission with name "user.personalinfo", actions "get". • * • * @return a gender value as defined in {@link User.Gender} • * @see User.Gender • */ • public User.Gender getGender() • { • if ( _checkPerms ) • { • SecurityUtil.checkPermission( _getPersonalInfo ); • } • return (User.Gender) _bbAttributes.getBbEnum( UserDef.GENDER ); • } • …… • }
  • 12. Profile Controller • @InitBinder • public void initDataBinder(WebDataBinder dataBinder) • { • dataBinder.registerCustomEditor(Gender.class, new GenderEditor()); • dataBinder.registerCustomEditor(EducationLevel.class, new EducationEditor()); • }
  • 13. Custom Editor • public class GenderEditor extends PropertyEditorSupport { – @Override – public String getAsText() { • // TODO Auto-generated method stub • Gender value = (Gender) getValue(); • return value.toFieldName(); – } – @Override – public void setAsText(String text) throws IllegalArgumentException { • // TODO Auto-generated method stub • //super.setAsText(text); • if (text.equalsIgnoreCase(Gender.FEMALE.toFieldName())) { – setValue(Gender.FEMALE); • } • else if (text.equalsIgnoreCase(Gender.MALE.toFieldName())) { – setValue(Gender.MALE); • } • else { – setValue(Gender.UNKNOWN); • } – } • }
  • 14. Profile View/JSP • <form:form id="profileForm" name="NewUserProfileForm" modelAttribute="spring25UserVO" method="POST"> • …… • </form:form>
  • 15. Profile View/JSP • <spring:message code="bb.userProfile.gender" var="gender"> </spring:message> • <bbNG:dataElement label="${gender}" isRequired="false"> • <!-- the "path" element (gender) points to the userVO.user.gender property • so as long as the userVO.user.gender reflects the value from the • DB (User.gender) such as "MALE"...this will be automatically • "selected" as well --> • <form:select path="userVO.user.gender" items="${genders}"/> • </bbNG:dataElement>
  • 18. jQuery Dialog • jQuery("#dialog").dialog({ • modal: true, • bgiframe: true, • width: 500, • height: 200, • autoOpen: false • }); • jQuery("#confirmDeleteImage").dialog({ • modal: true, • bgiframe: true, • autoOpen: false });
  • 19. jQuery Dialog …(cont) • jQuery(".myavatar").click(function (e) { • jQuery("#dialog").dialog({ • buttons : { • "Update" : function() { • window.location.href = "imageUpload.form"; • }, • "Delete" : function() { • jQuery(this).dialog("close"); • jQuery('#confirmDeleteImage').dialog('option', 'buttons', { • "No": function() { jQuery(this).dialog("close"); }, • "Yes": function() { window.location.href = "imageDelete.form"; } • }); • jQuery('#confirmDeleteImage').dialog('open'); • • }, • "Cancel" : function() { • jQuery(this).dialog("close"); • } • } • }); • jQuery("#dialog").dialog("open"); • return false; • });