SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
The Lift framework
     at least some parts of
agenda - How we divide
forms in lift
some facts
 Standard GET/POST support
 AJAX and JSON forms support
 No HTML form tags needed
   Implement as snippet in Scala
   Form generated by net.liftweb.http.SHtml
 Stateless by default
   Extend StatefulSnippet
   Use RequestVars for statefull purpose
some short dive 1 / 2
some short dive 2 / 2
checkbox - text area - password inputs
text area - password inputs
 Mostly like standard HTML input elements
 Generated by Shtml
 Overload XML with Pair(String, String)
   “attribute” → ”value”
checkbox




 Not submitted if unchecked
hidden element




 Not a plain value like in HTML
 Defined function is called on submit
 For logging, debugging or other
  calculations
Link - radio - (multi) selection
Link
 Like an HTML anchor
 Defined function is invoked on click
 Passing objects to linked page
radio button
 Set of radio buttons with String labels
(multi) selection
 selection
    List of options as Pair(value, display)
    Only one item may be selected
 multiselection
    Multiple select or pre-select
    Callback function proceeds for every returned value
 selectObj
    Handles passed objects as Pair(object, display)
file upload 1/2
 Special case of form submission
 SHtml generates file upload
  element with callback
 File is typed as FileParamHolder
  refenced by SHtml
 Whole file is loaded into
  memory on complete
file upload 2/2
site map
site map - facts
 Provides a map for your site
 Not only links and basic menu functionality
     Nested menus with hierarchies
     Grouping menus
     Access control mechanism
     Request URL rewriting
     State-dependent computations for page titles,
      page-specific snippets, etc.
Basic siteMap 1/2
Basic sitemap 2/2
 Creating menu entries with unique Loc
  reference
 Allow access to any pages with help of
  match
 Nested menu holds one or more child
  menus
customize display of menu
   Hide menu entries to restrict access
   Control menu item text
   Render menu title
   Customize menu with help of CSS
   Add JavaScript functionality
   Build menu groups
access control
 Extending binary control of given request
   "matches→display" otherwise don't display
 If LocParam
   Test Function evaluates given path
   Message Function returns failure response
    string
   User redirected to page with display for error
    state
 Unless LocParam
   Mirrors Test Function of If LocParam
Page-specific Rendering
The mapper and record
     frameworks
  - Making things persistent -
What is persistence?
    “Persistence in computer science refers to the
    characteristic of data that outlives the execution
    of the program that created it. Without this
    capability, data would only exist in RAM, and
    would be lost when this RAM loses power, such as
    on computer shutdown. This is achieved in
    practice by storing the data in non-volatile
    storage such as a hard drive or flash memory.

                                                  ”

Wikipedia
and mapping?


User
passwort:String
name:String
street:String
postnr:Longint
record vs. mapper
 Mapper is original Lift persistence
  framework
   Closely tied to JDBC
 Record is new refactorization of Mapper
   Define own Mapping Strategies (XML, JDBC,
    JPA)
 Mapper will be deprecated as soon as
  Records is stable
 Mapper will be used in this presentation
Get connected
 Extend
  net.liftweb.mapper.ConnectionManager
  trait
 Implement methods: newConnection and
  releaseConnection
Dbvendor extends connectionManager
                        name parameter
                         used to have
                         multiple databases
                        newConnection
                         needs to return a
                         Box[java.sql.Connecti
                         on]
                        releaseConnection
                         used to have
                         complete control of
                         the connection
                         lifecycle
                        Declare object in
                         Boot.scala
                        Call the
                         DB.defineConnection
                         Manager to bind
                         Manager into the
                         Mapper
make my class persistent
 Class Transaction from the PocketChange application
 We want to store:
    Date
    Description with a max length of 100 chars
    Amount of money used in a transaction
    And a account we want to reference to (described in detail
     later)
What have I typed here?
 Use LongKeyedMapper trait:
    Provide primary key for our entity
    Key should be long
    IdPK trait implements getPrimaryKeyField-method
 Defined as object due to MetaMapper, who needs access for
  validation
 getSingleton defines the MetaObject
how to set fields?
 Fields are no instance members:
   Use apply method to set:




   Use is to get:
Object relationship - one to many
Object relationship - many to many
Indexing




 More complex indexing via usage of the
  Index, IndexField and BoundedIndexField
  case classes
schema mapping
 Create database schema according to
  your objects




 Declared in Boot.scala
Working with entities
 MetaMapper is providing a lot of
  operations for an entity:
how to query data
 findAll returns all instances
 Use flag to define criterias to limit search
  result (trait QueryParam)




 By is used for direct value comparison
 BySQL let us use plain SQL as where clause
Other Queryparams to search for data
Getting things ordered
from mapping to html
 asHTML is rendering the mapper instance
  „as HTML“.
 Overriding for own behaviour
   eg own date format
from mapping to a form
 toForm is making it easy to create a form
  appropriate to an instance




 Third method has a „redo“ snippet parameter
  to save status
   User do not have to re-enter everything
from form to validation
 Validate submitted data
   User is not allowed to enter dates in the future




   Link function to validation
crud support
 Create, read, update, delete:
   Use CRUDify trait
Doing it oldschool - sql 1/2
 findAllByPreparedStatement




 findAllByInsecureSql
   Executes the String you submit directly without
    any checks
Doing it oldschool - sql 2/2
 DB.runQuery provides support for non-
  entity SQL queries
Protouser
 ProtoUser trait defines some basic fields for
  a user (email, firstName, lastName,
  password and superUser)
 Already some defs used to format the
  fields for display or to provide form labels
megaprotouser
 Extends the ProtoUser trait
 Automatically handle all of the scaffolding
  for a complete user management system
     User registration page
     Login page
     Lost password page
     Change password page
     User edit page
     Simple method to generate SiteMap
[- Showing some code in eclipse -]
conclusion
 Concepts are pretty nice
   Getting things done very quick out of box
 Scala as scripting language makes it mighty
 Would have been better to do presentations
  AFTER project
 Pretty hard to „give control“ to the framework
  („What is happening in the background?“)
 Lift book is bad.
 We would still prefer (G)Rails due to better
  tooling and experience
Disclaimer
   All images in this presentation are downloaded from flickr.com and marked with the creativecommons licence for
    commercial use.
   This presentation is restricted with the creativecommons licence (http://creativecommons.org/licenses/by-
    nd/3.0/de/deed.en):

Weitere ähnliche Inhalte

Was ist angesagt?

quickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudquickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudjorgesimao71
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase ConnectivityAkankshaji
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And XmlDavid Truxall
 
Database connect
Database connectDatabase connect
Database connectYoga Raja
 
5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow BasicsPramod Singla
 
Java Servlet
Java ServletJava Servlet
Java ServletYoga Raja
 
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...Lucas Jellema
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desaijmsthakur
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivityAtul Saurabh
 
quickguide-einnovator-5-springxd
quickguide-einnovator-5-springxdquickguide-einnovator-5-springxd
quickguide-einnovator-5-springxdjorgesimao71
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESYoga Raja
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12Sisir Ghosh
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshStrawhatLuffy11
 
Building a Backend with Flask
Building a Backend with FlaskBuilding a Backend with Flask
Building a Backend with FlaskMake School
 

Was ist angesagt? (20)

quickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloudquickguide-einnovator-8-spring-cloud
quickguide-einnovator-8-spring-cloud
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase Connectivity
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
Database connect
Database connectDatabase connect
Database connect
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics
 
JSP Error handling
JSP Error handlingJSP Error handling
JSP Error handling
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...Push to the limit - rich and pro-active user interfaces with ADF  (Oracle Ope...
Push to the limit - rich and pro-active user interfaces with ADF (Oracle Ope...
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Ado.net
Ado.netAdo.net
Ado.net
 
quickguide-einnovator-5-springxd
quickguide-einnovator-5-springxdquickguide-einnovator-5-springxd
quickguide-einnovator-5-springxd
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 
Http and REST APIs.
Http and REST APIs.Http and REST APIs.
Http and REST APIs.
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Building a Backend with Flask
Building a Backend with FlaskBuilding a Backend with Flask
Building a Backend with Flask
 

Andere mochten auch

Scrum in a nutshell for SEP HS Mannheim
Scrum in a nutshell for SEP HS MannheimScrum in a nutshell for SEP HS Mannheim
Scrum in a nutshell for SEP HS MannheimJeffrey Groneberg
 
Kulis Out Brief
Kulis Out BriefKulis Out Brief
Kulis Out Briefwilleetee
 
West Bank Service Learning Program Design July 16, 2009
West Bank Service Learning Program Design   July 16, 2009West Bank Service Learning Program Design   July 16, 2009
West Bank Service Learning Program Design July 16, 2009guestba5db42
 
West Bank Service Learning Program Design July 16, 2009
West Bank Service Learning Program Design   July 16, 2009West Bank Service Learning Program Design   July 16, 2009
West Bank Service Learning Program Design July 16, 2009guestba5db42
 
Nextoric profile
Nextoric profileNextoric profile
Nextoric profileKiki Kim
 
Nextoric profile eng-201008
Nextoric profile eng-201008Nextoric profile eng-201008
Nextoric profile eng-201008Kiki Kim
 
3 ways to make people love your chatbot
3 ways to make people love your chatbot3 ways to make people love your chatbot
3 ways to make people love your chatbotHarsh Jawharkar
 
West Bank Civic Engagement Presentation July 2009
West Bank Civic Engagement Presentation   July 2009West Bank Civic Engagement Presentation   July 2009
West Bank Civic Engagement Presentation July 2009guestba5db42
 
Personal Learning Environments
Personal Learning EnvironmentsPersonal Learning Environments
Personal Learning Environmentsjeunito
 
125th fw dsg hotel reservation process training edited fouo
125th fw dsg hotel reservation process training edited fouo125th fw dsg hotel reservation process training edited fouo
125th fw dsg hotel reservation process training edited fouowilleetee
 
Applying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To CivicApplying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To Civicguestba5db42
 
Rwanda Civic Education
Rwanda Civic EducationRwanda Civic Education
Rwanda Civic Educationguestba5db42
 
BizDataX White paper Test Data Management
BizDataX White paper Test Data ManagementBizDataX White paper Test Data Management
BizDataX White paper Test Data ManagementDragan Kinkela
 
Applying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To CivicApplying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To Civicguestba5db42
 
Narvar_State of Post Purchase Experience_January 2017
Narvar_State of Post Purchase Experience_January 2017Narvar_State of Post Purchase Experience_January 2017
Narvar_State of Post Purchase Experience_January 2017Harsh Jawharkar
 
OpenID Connect 101 @ OpenID TechNight vol.11
OpenID Connect 101 @ OpenID TechNight vol.11OpenID Connect 101 @ OpenID TechNight vol.11
OpenID Connect 101 @ OpenID TechNight vol.11Nov Matake
 
12312009 Leadership Academy
12312009 Leadership Academy12312009 Leadership Academy
12312009 Leadership Academywilleetee
 
Colin Powells 18 Lessons For Leaders
Colin Powells 18 Lessons For LeadersColin Powells 18 Lessons For Leaders
Colin Powells 18 Lessons For Leaderswilleetee
 

Andere mochten auch (19)

Scrum in a nutshell for SEP HS Mannheim
Scrum in a nutshell for SEP HS MannheimScrum in a nutshell for SEP HS Mannheim
Scrum in a nutshell for SEP HS Mannheim
 
Kulis Out Brief
Kulis Out BriefKulis Out Brief
Kulis Out Brief
 
West Bank Service Learning Program Design July 16, 2009
West Bank Service Learning Program Design   July 16, 2009West Bank Service Learning Program Design   July 16, 2009
West Bank Service Learning Program Design July 16, 2009
 
West Bank Service Learning Program Design July 16, 2009
West Bank Service Learning Program Design   July 16, 2009West Bank Service Learning Program Design   July 16, 2009
West Bank Service Learning Program Design July 16, 2009
 
Intercambios
IntercambiosIntercambios
Intercambios
 
Nextoric profile
Nextoric profileNextoric profile
Nextoric profile
 
Nextoric profile eng-201008
Nextoric profile eng-201008Nextoric profile eng-201008
Nextoric profile eng-201008
 
3 ways to make people love your chatbot
3 ways to make people love your chatbot3 ways to make people love your chatbot
3 ways to make people love your chatbot
 
West Bank Civic Engagement Presentation July 2009
West Bank Civic Engagement Presentation   July 2009West Bank Civic Engagement Presentation   July 2009
West Bank Civic Engagement Presentation July 2009
 
Personal Learning Environments
Personal Learning EnvironmentsPersonal Learning Environments
Personal Learning Environments
 
125th fw dsg hotel reservation process training edited fouo
125th fw dsg hotel reservation process training edited fouo125th fw dsg hotel reservation process training edited fouo
125th fw dsg hotel reservation process training edited fouo
 
Applying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To CivicApplying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To Civic
 
Rwanda Civic Education
Rwanda Civic EducationRwanda Civic Education
Rwanda Civic Education
 
BizDataX White paper Test Data Management
BizDataX White paper Test Data ManagementBizDataX White paper Test Data Management
BizDataX White paper Test Data Management
 
Applying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To CivicApplying Critical Thinking And Analytical Reasoning To Civic
Applying Critical Thinking And Analytical Reasoning To Civic
 
Narvar_State of Post Purchase Experience_January 2017
Narvar_State of Post Purchase Experience_January 2017Narvar_State of Post Purchase Experience_January 2017
Narvar_State of Post Purchase Experience_January 2017
 
OpenID Connect 101 @ OpenID TechNight vol.11
OpenID Connect 101 @ OpenID TechNight vol.11OpenID Connect 101 @ OpenID TechNight vol.11
OpenID Connect 101 @ OpenID TechNight vol.11
 
12312009 Leadership Academy
12312009 Leadership Academy12312009 Leadership Academy
12312009 Leadership Academy
 
Colin Powells 18 Lessons For Leaders
Colin Powells 18 Lessons For LeadersColin Powells 18 Lessons For Leaders
Colin Powells 18 Lessons For Leaders
 

Ähnlich wie Lift Framework

Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Michał Orman
 
ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)Lucas Jellema
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2Shahzad
 
Salesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewSalesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewNagarjuna Kaipu
 
Tuning and optimizing webcenter spaces application white paper
Tuning and optimizing webcenter spaces application white paperTuning and optimizing webcenter spaces application white paper
Tuning and optimizing webcenter spaces application white paperVinay Kumar
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentChui-Wen Chiu
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfStephieJohn
 
React, Flux and more (p1)
React, Flux and more (p1)React, Flux and more (p1)
React, Flux and more (p1)tuanpa206
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)Jo Cranford
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationAjax Experience 2009
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworksLuis Goldster
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 

Ähnlich wie Lift Framework (20)

Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1Integration of Backbone.js with Spring 3.1
Integration of Backbone.js with Spring 3.1
 
ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)
 
WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2WPF Windows Presentation Foundation A detailed overview Version1.2
WPF Windows Presentation Foundation A detailed overview Version1.2
 
Salesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewSalesforce Lightning Web Components Overview
Salesforce Lightning Web Components Overview
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
ReactJS
ReactJSReactJS
ReactJS
 
Tuning and optimizing webcenter spaces application white paper
Tuning and optimizing webcenter spaces application white paperTuning and optimizing webcenter spaces application white paper
Tuning and optimizing webcenter spaces application white paper
 
ReactJS.pptx
ReactJS.pptxReactJS.pptx
ReactJS.pptx
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
 
React, Flux and more (p1)
React, Flux and more (p1)React, Flux and more (p1)
React, Flux and more (p1)
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
SCDJWS 5. JAX-WS
SCDJWS 5. JAX-WSSCDJWS 5. JAX-WS
SCDJWS 5. JAX-WS
 
MyBatis
MyBatisMyBatis
MyBatis
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 

Kürzlich hochgeladen

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 

Kürzlich hochgeladen (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Lift Framework

  • 1. The Lift framework at least some parts of
  • 2. agenda - How we divide
  • 4. some facts  Standard GET/POST support  AJAX and JSON forms support  No HTML form tags needed  Implement as snippet in Scala  Form generated by net.liftweb.http.SHtml  Stateless by default  Extend StatefulSnippet  Use RequestVars for statefull purpose
  • 7. checkbox - text area - password inputs
  • 8. text area - password inputs  Mostly like standard HTML input elements  Generated by Shtml  Overload XML with Pair(String, String)  “attribute” → ”value”
  • 10. hidden element  Not a plain value like in HTML  Defined function is called on submit  For logging, debugging or other calculations
  • 11. Link - radio - (multi) selection
  • 12. Link  Like an HTML anchor  Defined function is invoked on click  Passing objects to linked page
  • 13. radio button  Set of radio buttons with String labels
  • 14. (multi) selection  selection  List of options as Pair(value, display)  Only one item may be selected  multiselection  Multiple select or pre-select  Callback function proceeds for every returned value  selectObj  Handles passed objects as Pair(object, display)
  • 15. file upload 1/2  Special case of form submission  SHtml generates file upload element with callback  File is typed as FileParamHolder refenced by SHtml  Whole file is loaded into memory on complete
  • 18. site map - facts  Provides a map for your site  Not only links and basic menu functionality  Nested menus with hierarchies  Grouping menus  Access control mechanism  Request URL rewriting  State-dependent computations for page titles, page-specific snippets, etc.
  • 20. Basic sitemap 2/2  Creating menu entries with unique Loc reference  Allow access to any pages with help of match  Nested menu holds one or more child menus
  • 21. customize display of menu  Hide menu entries to restrict access  Control menu item text  Render menu title  Customize menu with help of CSS  Add JavaScript functionality  Build menu groups
  • 22. access control  Extending binary control of given request  "matches→display" otherwise don't display  If LocParam  Test Function evaluates given path  Message Function returns failure response string  User redirected to page with display for error state  Unless LocParam  Mirrors Test Function of If LocParam
  • 24. The mapper and record frameworks - Making things persistent -
  • 25. What is persistence? “Persistence in computer science refers to the characteristic of data that outlives the execution of the program that created it. Without this capability, data would only exist in RAM, and would be lost when this RAM loses power, such as on computer shutdown. This is achieved in practice by storing the data in non-volatile storage such as a hard drive or flash memory. ” Wikipedia
  • 27. record vs. mapper  Mapper is original Lift persistence framework  Closely tied to JDBC  Record is new refactorization of Mapper  Define own Mapping Strategies (XML, JDBC, JPA)  Mapper will be deprecated as soon as Records is stable  Mapper will be used in this presentation
  • 28. Get connected  Extend net.liftweb.mapper.ConnectionManager trait  Implement methods: newConnection and releaseConnection
  • 29. Dbvendor extends connectionManager  name parameter used to have multiple databases  newConnection needs to return a Box[java.sql.Connecti on]  releaseConnection used to have complete control of the connection lifecycle  Declare object in Boot.scala  Call the DB.defineConnection Manager to bind Manager into the Mapper
  • 30. make my class persistent  Class Transaction from the PocketChange application  We want to store:  Date  Description with a max length of 100 chars  Amount of money used in a transaction  And a account we want to reference to (described in detail later)
  • 31. What have I typed here?  Use LongKeyedMapper trait:  Provide primary key for our entity  Key should be long  IdPK trait implements getPrimaryKeyField-method  Defined as object due to MetaMapper, who needs access for validation  getSingleton defines the MetaObject
  • 32. how to set fields?  Fields are no instance members:  Use apply method to set:  Use is to get:
  • 33. Object relationship - one to many
  • 34. Object relationship - many to many
  • 35. Indexing  More complex indexing via usage of the Index, IndexField and BoundedIndexField case classes
  • 36. schema mapping  Create database schema according to your objects  Declared in Boot.scala
  • 37. Working with entities  MetaMapper is providing a lot of operations for an entity:
  • 38. how to query data  findAll returns all instances  Use flag to define criterias to limit search result (trait QueryParam)  By is used for direct value comparison  BySQL let us use plain SQL as where clause
  • 39. Other Queryparams to search for data
  • 41. from mapping to html  asHTML is rendering the mapper instance „as HTML“.  Overriding for own behaviour  eg own date format
  • 42. from mapping to a form  toForm is making it easy to create a form appropriate to an instance  Third method has a „redo“ snippet parameter to save status  User do not have to re-enter everything
  • 43. from form to validation  Validate submitted data  User is not allowed to enter dates in the future  Link function to validation
  • 44. crud support  Create, read, update, delete:  Use CRUDify trait
  • 45. Doing it oldschool - sql 1/2  findAllByPreparedStatement  findAllByInsecureSql  Executes the String you submit directly without any checks
  • 46. Doing it oldschool - sql 2/2  DB.runQuery provides support for non- entity SQL queries
  • 47. Protouser  ProtoUser trait defines some basic fields for a user (email, firstName, lastName, password and superUser)  Already some defs used to format the fields for display or to provide form labels
  • 48. megaprotouser  Extends the ProtoUser trait  Automatically handle all of the scaffolding for a complete user management system  User registration page  Login page  Lost password page  Change password page  User edit page  Simple method to generate SiteMap
  • 49. [- Showing some code in eclipse -]
  • 50. conclusion  Concepts are pretty nice  Getting things done very quick out of box  Scala as scripting language makes it mighty  Would have been better to do presentations AFTER project  Pretty hard to „give control“ to the framework („What is happening in the background?“)  Lift book is bad.  We would still prefer (G)Rails due to better tooling and experience
  • 51. Disclaimer  All images in this presentation are downloaded from flickr.com and marked with the creativecommons licence for commercial use.  This presentation is restricted with the creativecommons licence (http://creativecommons.org/licenses/by- nd/3.0/de/deed.en):