SpringSource in 2008 (now part of Pivotal) – Taught Spring in over 20 countries ▪ Core-Spring, Spring MVC, Spring with JPA/Hibernate – Based in Singapore Blog: https://spring.io/team/misvy/ twitter: @michaelisvy
AngularJS Page templa4ng Yes, using Tiles or JSP custom tags Yes (na;ve to Angular) Form pos4ng JSon request Yes, using jQuery Yes (na;ve to Angular) Client-‐side form valida4on Yes, using jQuery Yes (na;ve to Angular) Par4al refresh Yes, using jQuery Yes (na;ve to Angular) Bootstrap integra4on Yes, manual integra;on Yes (plugin Angular-‐UI)
layer written in JavaScript View files are HTML files – HTML tags have special attributes called ‘Directives’ Browser compatibility: – Angular 1.4.x supports IE9 and above
vetResource = $resource('vets'); $scope.vetList = vetResource.query(); }]); Points to resource at http://localhost:8080/petclinic/vets GET query Result in JSon format VetController.js
{ @RequestMapping("/vets.html") public String showVetList(Map<String, Object> model) { Vets vets = this.clinicService.findVets(); model.put("vets", vets); return "vets/vetList"; } } Name: xController return view name Using model in request scope to communicate with JSP VetController.java
Class name ends with 'Controller' VetController ends with 'Resource' VetResource Returns model and view Model Object (Vet, Owner…) (view name informa;on on Java Script side) Communica4on with View Layer Uses request/session scope JSon data parsed on JavaScript side
for all scripts and CSS --> </head> <body class="container"> <div ng-include="'app/fragments/bodyHeader.html'"></div> <div ng-view></div> </body> </html> index.html Main PetClinic module Value inside app.js
are experienced with JavaScript You are experienced with jQuery You are experienced with REST in Spring MVC – Or with JAX-RS as an alternative to Spring MVC
need to restart Tomcat – Unless you have changed Java side (+) HTML pages are very clean (+) AJAX is built in (+) Many plugins available (+) Web Designer can run JavaScript side with Mock Data
refresh? – Do you need auto-complete? – Do you need validation on the client side? – Are you thinking to create a mobile application for your site? If yes, AngularJS is likely to be simpler than using JSP If not, just use JSP and use jQuery when needed