INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.

Slides:



Advertisements
Similar presentations
Pierre-Johan CHARTRE Java EE - JAX-RS - Pierre-Johan CHARTRE
Advertisements

SOAP Quang Vinh Pham Simon De Baets Université Libre de Bruxelles1.
ISE 390 Dynamic Web Development Java EE Web Applications.
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Integrating SOA and the Application Development Framework Shaun O’Brien Principal Product Manager – Oracle JDeveloper / ADF.
JBoss Seam: Contextual Components Jason Bechtel
Struts Basics SSE USTC Qing Ding. Agenda What is and Why Struts? Struts architecture – Controller: Focus of this presentation – Model – View Struts tag.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Spring Framework Benefits…
UNIT-V The MVC architecture and Struts Framework.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
JavaServer Faces Jeff Schmitt October 5, Introduction to JSF Presents a standard framework for building presentation tiers for web applications.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Introduction to Web Dimitar Nenchev Ivan Nakov
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
JAVA SERVER FACES ADITI RAJORIYA UNI – ar2630. POINTS TO BE DISSCUSED WHAT IS JSF? WHY JSF? ARCHITECTURE JSF VERSIONS UI COMPONENTS JSF STRUCTURE AND.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
JSP Custom Tags. Prerequisites Servlet API Mapping to JSP implicit objects JavaServer Pages Basic syntax Implementation via servlet API XML.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Spring and DWR Frameworks for Rich Web Enterprise Application Thomas Wiradikusuma Presentation to the 20 th.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
ICM – API Server & Forms Gary Ratcliffe.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
RESTful Web Services What is RESTful?
Lecture IV: REST Web Service
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Developing Rich Web Applications with.
Google Code Libraries Dima Ionut Daniel. Contents What is Google Code? LDAPBeans Object-ldap-mapping Ldap-ODM Bug4j jOOR Rapa jongo Conclusion Bibliography.
17 Copyright © 2004, Oracle. All rights reserved. Integrating J2EE Components.
Martin Kruliš by Martin Kruliš (v1.0)1.
Model View Controller. MVC is the separation of model, view and controller. It's simply a paradigm; an ideal that you should have in the back of your.
How to consume a RESTful service using jQuery. Introduction  In this post we see how to consume the RESTful service described in the post Design a RESTful.
Ext JS - Direct Bridging The Gap A DMSBT Presentation By Timothy Chandler.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
Web API - Introduction AJAX, Spring Data REST SoftUni Team Web API
z/Ware 2.0 Technical Overview
Google Web Toolkit Tutorial
J2EE Lecture 7: Spring – Spring MVC
Pre-assessment Questions
Knowledge Byte In this section, you will learn about:
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Ashish Pandit IT Architect, Middleware & Integration Services
CS5220 Advanced Topics in Web Programming Spring – Web MVC
The Model Layer What is Model?
CS5220 Advanced Topics in Web Programming Spring – Web MVC
Chengyu Sun California State University, Los Angeles
CS4961 Software Design Laboratory Understand Aquila Backend
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
Presentation transcript:

INTEGRATION OF BACKBONE.JS WITH SPRING 3.1

Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1 and Backbone.js integration by example

NEW FEATURES AND ENHANCEMENTS IN SPRING 3.1

New Features and Enhancements Cache Abstraction Bean Definition Profiles Environment Abstraction PropertySource Abstraction Java based-configuration Support for Hibernate 4.x c: namespace for constructor injection Support for injection against non-standard JavaBeans setters

New Features and Enhancements Support for Servlet 3.0 code-based configuration Support for Servlet 3.0 MultipartResolver JPA EntityManagerFactory bootstraping without persistence.xml New HandlerMethod-based Support Classes For Annotated Controller Processing "consumes" and "produces" conditions

New Features and Enhancements Flash Attributes and RedirectAttributes URI Template Variable Controller Method Annotation On Controller Method Arguments UriComponentsBuilder and UriComponents

Cache Abstraction Spring 3.1 provides support for transparently adding caching into an existing Spring application similar to the transaction public Book findBook(ISBN isbn) {...}

Environment Abstraction Unifies access to profiles and properties from different sources in public class PersistenceConfig private Environment public DataSource createDataSourceBean() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(env.getProperty("db.driverClass")); dataSource.setUrl(env.getProperty("db.url")); dataSource.setUsername(env.getProperty("db.username")); dataSource.setPassword(env.getProperty("db.password")); return dataSource; }

Servlet 3.0 No need for web.xml to bootstrap Spring 3.1 application. public class MyWebAppInitializer implements WebApplicationInitializer { public void onStartup(ServletContext servletContext) throws ServletException { // Application context’s (root and dispatcher) goes // here... }

Bean Definition Profiles Finally it is possible to define different set of components or different configuration for each environment (dev, test, production). Profiles may be defined via XML-configuration as well as Java-based config. Profiles are activated via environment variables, JVM properties or servlet init- params.

Produces and consumes Since Spring 3.1 we can specify media-type that is accepted and provided by mapped controller method. It is much more powerful than specifying Content-Type or Accept headers as used to do = POST, consumes = public Task Task task) { //... }

JSR-303 support for request body Request body can be validated using Bean Validation = POST, consumes public Task task) { // No BindingResult in method signature }

Exception Handlers Now we can annotation on @ResponseBody public Notification onException(MethodArgumentNotValidException ex) { FieldError error = ex.getBindingResult().getFieldError(); return new Notification(error.getField() + " " + error.getDefaultMessage()); }

Java based configuration Get rid off XML hell. Spring 3.1 can be bootstrapped and configured entirely via Java with fallback to XML @ComponentScan(basePackages = "pl.consileon") public class WebConfig { // Bean configuration goes here... }

BACKBONE.JS

What is this sorcery? Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.

So why do I need Backbone.js? You’re building application with lots of JavaScript providing great user experience. You’re frontend is bunch of jQuery selectors and callbacks trying to keep in sync your UI and backend? You’re convinced that backend shouldn’t care of rendering UI.

How Backbone.js works? The data is represented by Model(s) and Collection(s), which are backed by server application. ◦ Models and Collections communicate with backend API via REST interface with data formatted in Json UI is represented by View(s). Router maps URL’s to appropriate views.

Most important Views do not render anything by examining the Models attributes. Models and Collections notify appropriate Views about changes causing appropriate page fragments to re-render itself. Each View represents logical part of a page and is backed by the Model or Collection.

HomeView (Tasks collection) TaskView (Task)

The ‘el’ magic Each view is bound to some DOM element accessible via ‘el’ attribute. The el attribute automatically narrows the DOM that is searched via selectors ◦ Whenever attempt to access DOM element via selector, the element is searched in DOM fragment scoped by ‘el’ not in whole page so there is no need for adding additional attributes uniquely identifying the element. The ‘el’ attribute can be created from JavaScript templating library or bound to existing DOM element.

How to test it? plugin/ plugin/

DEMO list

API GET /tasks – list tasks POST /tasks – create task PUT /tasks/:id – update task DELETE /tasks/:id – delete task

Q&A