SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
Das Web-Framework für Scala
     Heiko Seeberger



        Copyright WeigleWilczek 2009
WARUM SIND WIR EIGENTLICH HIER?

 “Lift is the only new framework in the last four years to offer fresh and
      innovative approaches to web development. It's not just some
incremental improvements over the status quo, it redefines the state of
        the art. If you are a web developer, you should learn Lift ...”

                                                   Michael Galpin, Developer, eBay




                                    2
WARUM NOCH EIN WEB-FRAMEWORK?
                           Lift pickt Rosinen von
                           anderen Frameworks




  Lift bringt eigene
innovative Ansätze

                       3
DEMO: CHAT MIT 20 ZEILEN SCALA CODE




                 4
FÜR’S PROTOKOLL

•   Projekt generieren mit mvn archetype:generate ...

•   ChatServer.scala anlegen

•   Chat.scala anlegen

•   chat.xhtml Template anlegen

•   In Boot.scala neues Menu zur SiteMap hinzufügen


                                     5
DIE ANFÄNGE
     David Pollak                  Einfach zu benutzen




  Scala with Sails                 Sicher
                        2006

Keep the meaning
   with the bytes                  Einfach zu deployen

                          6
HEUTE
Lift 1.1 vor der Tür                Sehr rege Community




Etliche Sites powered by Lift             32 Committer

                                7
FEATURES IM ANGEBOT

 Templates         Sitemap



Comet                  Persistenz



        AJAX       User Management


               8
“MUSTERLÖSUNG”




      9
WEITERE FEATURES (UNVOLLSTÄNDIG)

        Wizards         JPA und JTA

    OpenID                   JSON


     AMPQ                    OSGi

         Textile        PayPay


                   10
TEMPLATES




    11
WIE SCHREIBEN WIR TEMPLATES?

        <html>
          <head>
                                                   In XHTML
            <title>kix</title>
            ...
          <body>
            <div class="container">
               ...
               <div class="span-18 last">
                 <lift:Msgs showAll="true"/>
mit Lift-Tags    <lift:bind name="content"/>
                 ...
               </div>
               <div class="span-12" style="text-align: center;">
                 <img src="/images/pbww.png"/>
               </div>
               ...




                                   12
TEMPLATES VERSCHACHTELN

  <lift:bind ... />




            <lift:surround ...>




            13
SNIPPETS EINBINDEN
                   class Games {
        Snippet      def upcoming5(xhtml: NodeSeq) =
                       bind("games", xhtml, "list" -> bindGames(Game upcoming 5, xhtml))




<lift:surround with="default" at="content">
      ...
      <lift:Games.upcoming5> Snippet-Tag
        <games:list>
          <tr game:class="">
            <td><span game:id=""><game:action/></span></td>
            <td><game:date/></td>
            <td><game:group/></td>              Platzhalter im
            <td><game:location/></td>
            <td><game:teams/></td>              Namespace game
            ...




                                           14
SNIPPETS UND BINDING

class Games {

  def upcoming5(xhtml: NodeSeq) =
    bind("games", xhtml, "list" -> bindGames(Game upcoming 5, xhtml))

  private def bindGames(games: List[Game], xhtml: NodeSeq) = {
    val oddOrEven = OddOrEven()
    games flatMap { game =>
      bind("game", chooseTemplate("games", "list", xhtml),
           "date" -> format(game.date.is, locale),
           "group" -> game.group.is.toString,
           "location" -> game.location.is,
           ...
                        Platzhalter ersetzen


                                 15
LIVE DEMO




    16
SITEMAP




   17
MENÜS UND ZUGRIFFSKONTROLLE




             18
SITEMAP ANLEGEN

val ifAdmin = If(() => User.superUser_?, () => RedirectResponse("/index"))

val homeMenu = Menu(Loc("home", ("index" :: Nil) -> false, "Home"))
...
val adminMenu = Menu(Loc("admin", ("admin" :: Nil) -> true, "Admin", ifAdmin),
                     adminSubMenu: _*)

val menus = homeMenu ::
            ...
            adminMenu ::
            User.sitemap

LiftRules setSiteMap SiteMap(menus : _*)




                                       19
MENÜS ANZEIGEN

<html>
  <head>
    <title>kix</title>
    ...
  <body>
    <div class="container">
       ...
       <div class="span-5">
         <div class="menu">
           <lift:Menu.builder/>
         </div>
         ...




                            20
LIVE DEMO




    21
PERSISTENZ




    22
MAPPER
class Game extends LongKeyedMapper[Game] with IdPK {

  object group extends MappedEnum(this, Group) {
    override def displayName = ?("Group")
  }

  object team1 extends MappedTeam(this, "Team 1")

  object team2 extends MappedTeam(this, "Team 2")

  object date extends MappedDateTime(this) {
    override def displayName = ?("Date")
  }

  object location extends MappedString(this, 100) {
    override def displayName = ?("Location")
  }
  ...                                          Keep the meaning
                                               with the bytes
                         23
CRUD SUPPORT

... with CRUDify[Long, Game]




        24
SCHEMA ANLEGEN


val dbVendor =
  new StandardDBVendor(Props get "db.driver" openOr "org.h2.Driver",
                       Props get "db.url" openOr "jdbc:h2:kix",
                       Empty, Empty) {
  override def maxPoolSize = Props getInt "db.pool.size" openOr 3
}
DB.defineConnectionManager(DefaultConnectionIdentifier, dbVendor)
Schemifier.schemify(true, Log.infoF _, Team, Game, Result, Tip, User)




                                 25
LIVE DEMO




    26
USER MANAGEMENT




       27
CLAUSTHALER-PRINZIP




         28
MORE THAN JUST CRUD

class User extends MegaProtoUser[User] {

    override def shortName = {
      val s = super.shortName
      val i = s indexOf "@"
      if (i == -1) s else s.substring(0, i)
    }

    override def firstNameDisplayName = ?("Name")

    object points extends MappedInt(this)
}




                                   29
LIVE DEMO




    30
AJAX SUPPORT




     31
BEISPIEL: LISTEN-ELEMENTE LÖSCHEN




                32
SCALA API FÜR AJAX

def editDelete(tip: Tip) = {
  def delete = {
    Tip delete_! tip
    SetHtml(tip.id.is.toString, NodeSeq.Empty)
  }
  renderEditDelete(tip, delete _)
}

private def renderEditDelete(tip: Tip, jsCmd: () => JsCmd) =
  link("/tips/edit", () => currentTip(Full(tip)), editImg) ++
  Text("") ++
  ajaxDeleteImg(ajaxInvoke(jsCmd))




                                 33
LIVE DEMO




    34
COMET SUPPORT




      35
CHATTEN LEICHT GEMACHT




          36
FRAGEN / DISKUSSION




         37
DANKE

Kontakt: seeberger@weiglewilczek.com

 Mehr lernen: www.scalatraining.net




                 38

Contenu connexe

Similaire à W-JAX 09 - Lift

Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkIndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Frameworkvhazrati
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.jsBert Wijnants
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesEdgar Gonzalez
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesMarakana Inc.
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Living the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonLiving the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonParis Container Day
 
Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...benjaoming
 
Bulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & CouchbaseBulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & CouchbaseAlex Derkach
 
Scala4sling
Scala4slingScala4sling
Scala4slingday
 
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL SpartakiadeJohannes Hoppe
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
From Java to Scala - advantages and possible risks
From Java to Scala - advantages and possible risksFrom Java to Scala - advantages and possible risks
From Java to Scala - advantages and possible risksSeniorDevOnly
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptGuy Royse
 

Similaire à W-JAX 09 - Lift (20)

Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.js
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and Techniques
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and Techniques
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Living the Nomadic life - Nic Jackson
Living the Nomadic life - Nic JacksonLiving the Nomadic life - Nic Jackson
Living the Nomadic life - Nic Jackson
 
Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...Strategies for refactoring and migrating a big old project to be multilingual...
Strategies for refactoring and migrating a big old project to be multilingual...
 
Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Bulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & CouchbaseBulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & Couchbase
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Scala4sling
Scala4slingScala4sling
Scala4sling
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade2013-03-23 - NoSQL Spartakiade
2013-03-23 - NoSQL Spartakiade
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
From Java to Scala - advantages and possible risks
From Java to Scala - advantages and possible risksFrom Java to Scala - advantages and possible risks
From Java to Scala - advantages and possible risks
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
 

Plus de Heiko Seeberger

Scaladays 2011 - The Ease of Scalaz
Scaladays 2011 - The Ease of ScalazScaladays 2011 - The Ease of Scalaz
Scaladays 2011 - The Ease of ScalazHeiko Seeberger
 
RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?Heiko Seeberger
 
Objektforum 2010 - Sprechen Sie Scala?
Objektforum 2010 - Sprechen Sie Scala?Objektforum 2010 - Sprechen Sie Scala?
Objektforum 2010 - Sprechen Sie Scala?Heiko Seeberger
 
JM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewJM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewHeiko Seeberger
 
OSGi DevCon Europe 09 - OSGi on Scala
OSGi DevCon Europe 09 - OSGi on ScalaOSGi DevCon Europe 09 - OSGi on Scala
OSGi DevCon Europe 09 - OSGi on ScalaHeiko Seeberger
 
JAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsJAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsHeiko Seeberger
 
Eclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractEclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractHeiko Seeberger
 
Eclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiEclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiHeiko Seeberger
 
Eclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingEclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingHeiko Seeberger
 
Eclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxEclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxHeiko Seeberger
 
Eclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterEclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterHeiko Seeberger
 

Plus de Heiko Seeberger (20)

Scaladays 2011 - The Ease of Scalaz
Scaladays 2011 - The Ease of ScalazScaladays 2011 - The Ease of Scalaz
Scaladays 2011 - The Ease of Scalaz
 
Java Magazin - Lift
Java Magazin - LiftJava Magazin - Lift
Java Magazin - Lift
 
JavaSPEKTRUM - Scala 3
JavaSPEKTRUM - Scala 3JavaSPEKTRUM - Scala 3
JavaSPEKTRUM - Scala 3
 
JavaSPEKTRUM - Scala 2
JavaSPEKTRUM - Scala 2JavaSPEKTRUM - Scala 2
JavaSPEKTRUM - Scala 2
 
JavaSPEKTRUM - Scala 1
JavaSPEKTRUM - Scala 1JavaSPEKTRUM - Scala 1
JavaSPEKTRUM - Scala 1
 
RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?
 
Objektforum 2010 - Sprechen Sie Scala?
Objektforum 2010 - Sprechen Sie Scala?Objektforum 2010 - Sprechen Sie Scala?
Objektforum 2010 - Sprechen Sie Scala?
 
W-JAX 09 - ScalaModules
W-JAX 09 - ScalaModulesW-JAX 09 - ScalaModules
W-JAX 09 - ScalaModules
 
JM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewJM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala Review
 
JM 08/09 - ScalaModules
JM 08/09 - ScalaModulesJM 08/09 - ScalaModules
JM 08/09 - ScalaModules
 
OSGi DevCon Europe 09 - OSGi on Scala
OSGi DevCon Europe 09 - OSGi on ScalaOSGi DevCon Europe 09 - OSGi on Scala
OSGi DevCon Europe 09 - OSGi on Scala
 
JAX 09 - OSGi on Scala
JAX 09 - OSGi on ScalaJAX 09 - OSGi on Scala
JAX 09 - OSGi on Scala
 
JAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsJAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components Models
 
JAX 08 - Agile RCP
JAX 08 - Agile RCPJAX 08 - Agile RCP
JAX 08 - Agile RCP
 
Eclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractEclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by Contract
 
JUGM 07 - AspectJ
JUGM 07 - AspectJJUGM 07 - AspectJ
JUGM 07 - AspectJ
 
Eclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiEclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der Drei
 
Eclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingEclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance Logging
 
Eclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxEclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on Equinox
 
Eclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterEclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matter
 

Dernier

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Dernier (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

W-JAX 09 - Lift

  • 1. Das Web-Framework für Scala Heiko Seeberger Copyright WeigleWilczek 2009
  • 2. WARUM SIND WIR EIGENTLICH HIER? “Lift is the only new framework in the last four years to offer fresh and innovative approaches to web development. It's not just some incremental improvements over the status quo, it redefines the state of the art. If you are a web developer, you should learn Lift ...” Michael Galpin, Developer, eBay 2
  • 3. WARUM NOCH EIN WEB-FRAMEWORK? Lift pickt Rosinen von anderen Frameworks Lift bringt eigene innovative Ansätze 3
  • 4. DEMO: CHAT MIT 20 ZEILEN SCALA CODE 4
  • 5. FÜR’S PROTOKOLL • Projekt generieren mit mvn archetype:generate ... • ChatServer.scala anlegen • Chat.scala anlegen • chat.xhtml Template anlegen • In Boot.scala neues Menu zur SiteMap hinzufügen 5
  • 6. DIE ANFÄNGE David Pollak Einfach zu benutzen Scala with Sails Sicher 2006 Keep the meaning with the bytes Einfach zu deployen 6
  • 7. HEUTE Lift 1.1 vor der Tür Sehr rege Community Etliche Sites powered by Lift 32 Committer 7
  • 8. FEATURES IM ANGEBOT Templates Sitemap Comet Persistenz AJAX User Management 8
  • 10. WEITERE FEATURES (UNVOLLSTÄNDIG) Wizards JPA und JTA OpenID JSON AMPQ OSGi Textile PayPay 10
  • 11. TEMPLATES 11
  • 12. WIE SCHREIBEN WIR TEMPLATES? <html> <head> In XHTML <title>kix</title> ... <body> <div class="container"> ... <div class="span-18 last"> <lift:Msgs showAll="true"/> mit Lift-Tags <lift:bind name="content"/> ... </div> <div class="span-12" style="text-align: center;"> <img src="/images/pbww.png"/> </div> ... 12
  • 13. TEMPLATES VERSCHACHTELN <lift:bind ... /> <lift:surround ...> 13
  • 14. SNIPPETS EINBINDEN class Games { Snippet def upcoming5(xhtml: NodeSeq) = bind("games", xhtml, "list" -> bindGames(Game upcoming 5, xhtml)) <lift:surround with="default" at="content"> ... <lift:Games.upcoming5> Snippet-Tag <games:list> <tr game:class=""> <td><span game:id=""><game:action/></span></td> <td><game:date/></td> <td><game:group/></td> Platzhalter im <td><game:location/></td> <td><game:teams/></td> Namespace game ... 14
  • 15. SNIPPETS UND BINDING class Games { def upcoming5(xhtml: NodeSeq) = bind("games", xhtml, "list" -> bindGames(Game upcoming 5, xhtml)) private def bindGames(games: List[Game], xhtml: NodeSeq) = { val oddOrEven = OddOrEven() games flatMap { game => bind("game", chooseTemplate("games", "list", xhtml), "date" -> format(game.date.is, locale), "group" -> game.group.is.toString, "location" -> game.location.is, ... Platzhalter ersetzen 15
  • 16. LIVE DEMO 16
  • 17. SITEMAP 17
  • 19. SITEMAP ANLEGEN val ifAdmin = If(() => User.superUser_?, () => RedirectResponse("/index")) val homeMenu = Menu(Loc("home", ("index" :: Nil) -> false, "Home")) ... val adminMenu = Menu(Loc("admin", ("admin" :: Nil) -> true, "Admin", ifAdmin), adminSubMenu: _*) val menus = homeMenu :: ... adminMenu :: User.sitemap LiftRules setSiteMap SiteMap(menus : _*) 19
  • 20. MENÜS ANZEIGEN <html> <head> <title>kix</title> ... <body> <div class="container"> ... <div class="span-5"> <div class="menu"> <lift:Menu.builder/> </div> ... 20
  • 21. LIVE DEMO 21
  • 23. MAPPER class Game extends LongKeyedMapper[Game] with IdPK { object group extends MappedEnum(this, Group) { override def displayName = ?("Group") } object team1 extends MappedTeam(this, "Team 1") object team2 extends MappedTeam(this, "Team 2") object date extends MappedDateTime(this) { override def displayName = ?("Date") } object location extends MappedString(this, 100) { override def displayName = ?("Location") } ... Keep the meaning with the bytes 23
  • 24. CRUD SUPPORT ... with CRUDify[Long, Game] 24
  • 25. SCHEMA ANLEGEN val dbVendor = new StandardDBVendor(Props get "db.driver" openOr "org.h2.Driver", Props get "db.url" openOr "jdbc:h2:kix", Empty, Empty) { override def maxPoolSize = Props getInt "db.pool.size" openOr 3 } DB.defineConnectionManager(DefaultConnectionIdentifier, dbVendor) Schemifier.schemify(true, Log.infoF _, Team, Game, Result, Tip, User) 25
  • 26. LIVE DEMO 26
  • 29. MORE THAN JUST CRUD class User extends MegaProtoUser[User] { override def shortName = { val s = super.shortName val i = s indexOf "@" if (i == -1) s else s.substring(0, i) } override def firstNameDisplayName = ?("Name") object points extends MappedInt(this) } 29
  • 30. LIVE DEMO 30
  • 33. SCALA API FÜR AJAX def editDelete(tip: Tip) = { def delete = { Tip delete_! tip SetHtml(tip.id.is.toString, NodeSeq.Empty) } renderEditDelete(tip, delete _) } private def renderEditDelete(tip: Tip, jsCmd: () => JsCmd) = link("/tips/edit", () => currentTip(Full(tip)), editImg) ++ Text("") ++ ajaxDeleteImg(ajaxInvoke(jsCmd)) 33
  • 34. LIVE DEMO 34
  • 38. DANKE Kontakt: seeberger@weiglewilczek.com Mehr lernen: www.scalatraining.net 38