SlideShare ist ein Scribd-Unternehmen logo
1 von 127
Downloaden Sie, um offline zu lesen
GeLiftete Web-Applikation mit Scala
                                JAX 2009



                              Tobias Joch
                              inovex GmbH




 Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
Scala
Lift
  Grundlagen
    Architektur Überblick
    Module
    Template Verarbeitung
    Tags und Snippets
    Head Merge
    Scopes
    I18n
    Persistenz
    AJAX
  in Action
  Fazit / Ausblick / weiterführende Informationen
                                                    2
3
Scala = SCAlable LAnguage




                            4
Scala = SCAlable LAnguage
wächst mit den Bedürfnissen der User
kleine Skripte bis hin zu großen und komplexen
Systemen
Multiparadigmensprache
  verbindet objektorientierte (imperative) und funktionale
  Programmierung
pragmatisch, typsicher, strikt objektorientiert
interoperabel mit Standard Plattformen (Java, .NET)          4
Wurzeln reichen zurück in das Jahr 1995
Philip Wadler und Martin Odersky
  Funktionale Programmiersprachen für die JVM
     Pizza
     GJ (Generic Language Extension für Java)
     javac
     Java Generics
1999 verfolgte Martin Odersky das Ziel funktionale mit
OO Programmierung zu kombinieren
  Funnel
  Scala
     *2001, 2003 erstes Public Release, 2006 Version 2.0,
     aktuell 2.7.4 RC1                                      5
Ziel von Scala:
Das Beste aus beiden Welten (OO und FP)
  Statisch typisiert + Typinferenz
  Funktionen höherer Ordnung
  Traits, Mixin-Komposition
  Option-Klasse (None und Some vs. null)
  Pattern Matching
  Algebraische Typen
  Native XML-Unterstützung inkl. XPath Unterstützung (Bibliothek)
  Actor Model
  Currying
  Anonyme Funktionen
  Parametrische Polymorphie                                         6
Einige reservierte Schlüsselwörter in Scala
  class, case class, object
  new
  with
  extends
  abstract
  sealed
  trait
  def, var, val
  override
  match, case
                                              7
in Action ;)




               8
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Imperative vs. funktionale Programmierung (I)
 public class Example1 {
 	 public static void main(String[] args) {
 	 	 for (String arg : args) {
 	 	 	 System.out.println(arg);
 		}
 	}
 }




                                                10
Imperative vs. funktionale Programmierung (I)
 public class Example1 {
 	 public static void main(String[] args) {
 	 	 for (String arg : args) {
 	 	 	 System.out.println(arg);
 		}
 	}
 }


 object Example1 {
    def main(args: Array[String]) {
       args.foreach(println)
    }
 }
                                                10
Imperative vs. funktionale Programmierung (II)
  public class Example2 {
  	 public static void main(String[] args) {
  	 	 for (String arg : args) {
  	 	 	 if (arg.startsWith(quot;JAX09quot;)) {
  	 	 	 	 System.out.println(arg);
  			}
  		}
  	}
  }




                                                 11
Imperative vs. funktionale Programmierung (II)
  public class Example2 {
  	 public static void main(String[] args) {
  	 	 for (String arg : args) {
  	 	 	 if (arg.startsWith(quot;JAX09quot;)) {
  	 	 	 	 System.out.println(arg);
  			}
  		}
  	}
  }

  object Example2 {
    def main(args: Array[String]) {
      args.filter(_.startsWith(quot;JAX09quot;)).foreach(println)
    }
  }                                                         11
Imperative vs. funktionale Programmierung (III)
  public class Example3 {
  	   public static void main(String[] args) {
  	   	   boolean exists = false;
  	   	   for (String arg : args) {
  	   	   	   if (arg.startsWith(quot;JAX09quot;)) {
  	   	   	   	   exists = true;
  	   	   	   	   break;
  	   	   	   }
  	   	   }
  	   	   System.out.print(exists);
  	   }
  }




                                                  12
Imperative vs. funktionale Programmierung (III)
  public class Example3 {
  	   public static void main(String[] args) {
  	   	   boolean exists = false;
  	   	   for (String arg : args) {
  	   	   	   if (arg.startsWith(quot;JAX09quot;)) {
  	   	   	   	   exists = true;
  	   	   	   	   break;
  	   	   	   }
  	   	   }
  	   	   System.out.print(exists);
  	   }
  }

  object Example3 {
    def main(args: Array[String]) {
      print(args.exists(_.startsWith(quot;JAX09quot;)))
    }
  }                                               12
Grundlagen
             13
David Pollak
  Gründer von Lift
  Kommerzielle Softwareentwicklung seit 1977
  Web-Applikationen seit 1996
15. Februar 2007:
Initial Import (GitHub) in der Version 0.1.0
Gründung von Lift als OS Projekt in 2007
26. Februar 2009:
Lift 1.0
Aktuelles Lift-Team besteht aus 13 Comitter
Aktive Community
  http://groups.google.com/group/liftweb       14
„Best of all“
Scala als zugrundeliegende Sprache
  nativer XML-Support (XHTML nativ innerhalb von Snippets!)
  Scala Actors für mächtige Comet-Anwendungen
fein granulare Sessions und Security (Seaside)
schnelles Projektsetup durch „convention over
configuration“ + geringe Turnaround-Zeiten (Rails)
Django's quot;more than just CRUD is includedquot;
Designer freundliche Templates (Wicket / Lift View First)
Offen für die Nutzung von zahlreichen OSS-Bibliotheken
(Java)
Etablierte Deployment-Prozesse (JEE / Java)                   15
Weitere Eigenschaften / Ziele von Lift
  Sicherheit
     XSS, replay Attacken, Parameter tampering
  Wartbarkeit
  Skalierbarkeit
  Performance
  Hohe Produktivität
  Einfach
  Convention over configuration
  DRY

                                                 16
„View First“ Design-Prinzip
     Templates enthalten keinen Code
     Pures XHTML
     Können mit Standard Design-Werkzeugen bearbeitet
     werden
     Frontend ist ohne Scala-Kenntnisse von einem Designer
     realisierbar

    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>


                                                             17
Architektur Überblick
                        18
Lift-Framework




                 19
Lift-Framework




                 Scala Framework
                                   19
Lift-Framework




                  Lift-Framework

                 Scala Framework
                                   19
Lift-Framework




                 Lift Core
                    Lift-Framework

                  Scala Framework
                                     19
LiftSession

                                                               LiftRules

                                                              LiftResponse
                                                                             Lift-Framework


                                                                   S


                                                                 SHtml


                                                                JS API




                                    Lift Core
                                                Lift Webkit     SiteMap

                                                              Menu, Msgs,



                   Lift-Framework

 Scala Framework
                                                                 CSS

                                                              HTTP Auth


                                                                Comet
19
LiftSession

                                                               LiftRules


                                                                             Mapper
                                                              LiftResponse
                                                                                      Lift-Framework


                                                                   S


                                                                 SHtml
                                                                             Record




                                                                JS API




                                    Lift Core
                                                Lift Webkit     SiteMap

                                                              Menu, Msgs,



                   Lift-Framework

 Scala Framework
                                                                 CSS

                                                              HTTP Auth


                                                                Comet
19
Lift-Framework

              Mapper                               Record                                     Testkit
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                 Lift Webkit




                                                  Lift Core
                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                 19
Lift-Framework

              Mapper                               Record                                     Testkit
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                 Lift Webkit


                                                    Lift Util

                                                  Lift Core
                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                 19
Lift-Framework
                                                                                                                  Lift XMPP
              Mapper                               Record                                     Testkit

                                                                                                                 Lift Facebook
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                                                                                                                 Lift Widgets
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                                                                                  Lift OpenId

                                                                                                                  Lift OAuth
                                                 Lift Webkit

                                                                                                                  Lift Paypal
                                                    Lift Util

                                                                                                                  Lift AMQP
                                                  Lift Core
                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                                 19
Grobe Architektur einer Lift-Applikation




                                           20
Grobe Architektur einer Lift-Applikation




                       Java Virtual Machine
                                              20
Grobe Architektur einer Lift-Applikation




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates



                                      Snippets




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates



                                      Snippets



                                        Views




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                        Templates



                                        Snippets



                                          Views



                                Boot.scala (LiftRules etc,)


                                    Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                              20
Grobe Architektur einer Lift-Applikation
                                        Templates



                                        Snippets




                                                              Model
                                          Views



                                Boot.scala (LiftRules etc,)


                                    Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                                      20
Grobe Architektur einer Lift-Applikation
                                                   Templates



                                                   Snippets




                                                                         Model
               LiftFilter



                                                     Views



                                           Boot.scala (LiftRules etc,)


                                               Lift Framework




                            Servlet Container (e.g. Jetty or Tomcat)

                                      Java Virtual Machine
                                                                                 20
Grobe Architektur einer Lift-Applikation
                                                           Templates



                                                           Snippets



                                 LiftServlet




                                                                                 Model
               LiftFilter



                                                             Views



                                                   Boot.scala (LiftRules etc,)


                                                       Lift Framework




                            Servlet Container (e.g. Jetty or Tomcat)

                                               Java Virtual Machine
                                                                                         20
Grobe Architektur einer Lift-Applikation
                                                           Templates



                                                           Snippets



                                 LiftServlet




                                                                                 Model
               LiftFilter



                                                             Views



                                                   Boot.scala (LiftRules etc,)


                                                       Lift Framework

                                                        DefaultServlet

                            Servlet Container (e.g. Jetty or Tomcat)

                                               Java Virtual Machine
                                                                                         20
Grober Ablauf einer Anfragenbearbeitung




Request   URL rewrite              custom dispatch          Template              View   Response
                        Response




                                                 Response




                                                                       Response



                                                                                                    21
Grober Ablauf einer Anfragenbearbeitung

                                                                       Template


Request   URL rewrite              custom dispatch                        View    Response
                        Response




                                                 Response




                                                            Response



                                                                                             21
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema




                                          22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]




                                           22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung




                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben




                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben
Lift versteckt Templates und
Ressourcen in Verzeichnissen
welche als Endung -hidden im
Namen tragen
                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben
Lift versteckt Templates und
Ressourcen in Verzeichnissen
welche als Endung -hidden im
Namen tragen
                                             22
Template




           23
Template




Templates = Content + Tags + Snippets




                                        23
Template




Templates = Content + Tags + Snippets
Tags = Lift spezifische Funktionen
  surround
  bind
  embed
  comet
  loc




                                        23
Template




Templates = Content + Tags + Snippets
Tags = Lift spezifische Funktionen
  surround
  bind
  embed
  comet
  loc
Snippets
  vergleichbar mit Taglibs
  <lift:snippet type=Jax:render />
  <lift:Jax.render />
  <lift:Jax />                          23
›
                          Template




    Template Verarbeitung von Außen nach Innen




                                                 24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with=quot;defaultquot; at=quot;contentquot;>
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>




                                                      24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with=quot;defaultquot; at=quot;contentquot;>
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>

/templates-hidden/default.html

    <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;>
      <head>...</head>
      <body>
       ...
       <lift:bind name=quot;contentquot; />
      </body>
    </html>

                                                          24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with=quot;defaultquot; at=quot;contentquot;>
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>

/templates-hidden/default.html

    <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;>
      <head>...</head>
      <body>
       ...
       <lift:bind name=quot;contentquot; />
      </body>
    </html>

        Ausführung von HelloWorld#howdy                   24
Template




Head Merge




                        25
Template




  Head Merge
/index.html

   <lift:surround with=quot;defaultquot; at=quot;contentquot;>
      <head><script type=quot;text/javascriptquot;>...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>




                                                                    25
Template




  Head Merge
/index.html

   <lift:surround with=quot;defaultquot; at=quot;contentquot;>
      <head><script type=quot;text/javascriptquot;>...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>


/templates-hidden/default.html

 <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;>
   <head>...</head>
   <body>
    ...
    <lift:bind name=quot;contentquot; />
   </body>
 </html>
                                                                    25
Template




  Head Merge
/index.html

   <lift:surround with=quot;defaultquot; at=quot;contentquot;>
      <head><script type=quot;text/javascriptquot;>...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>


/templates-hidden/default.html

 <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;>
   <head>...</head>
   <body>
    ...
    <lift:bind name=quot;contentquot; />
   </body>
 </html>
                                                                    25
Scopes
  S
  Stateful Snippet
  RequestVar
  SessionVar
  Scala Object (Singleton)




                             26
Internationalisierung / I18n
   java.util.Locale
   java.util.ResourceBundle
      LiftRules.resourceNames
Ermittlung der aktuellen Sprache
   LiftRules.localeCalculator
      Request-Header
      Fallback: Locale.getDefault()
Snippets
   S.?
Templates
<lift:loc locid=quot;liftquot;>Aufzug</lift:loc>
<lift:loc>lift</lift:loc>                  27
Persistenz in Lift
  Mapper
  Record
  JPA
  JDO
  Hibernate
  ...
Lift selbst ist Persistenz agnostisch



                                        28
AJAX in Lift
    SHtml
        ajaxButton
        ajaxText
        ajaxCheckbox
        ...


def render(in: NodeSeq): NodeSeq =
    SHtml.ajaxButton(quot;Click me ;)quot;, () => {
	   	   println(quot;Yes, thanks!quot;)
	   	   JsCmds.SetHtml(quot;click-divquot;, Text(quot;Yes, thanks!quot;))
    })



                                                            29
in Action ;)
               30
Entwicklungsumgebung
  Java (>= 5)
  Maven (>= 2.0.9)
  Web-Container (Jetty, Tomcat, ...)
Optional, aber nützlich
  JavaRebel (JVM Plugin / Java Agent)
  IDE mit Scala Support / Plugin (Eclipse, IDEA,
  Netbeans, ...)
     http://www.scala-lang.org/scala-eclipse-plugin



                                                      31
Projekt anlegen




                  32
Projekt anlegen
$mvn archetype:generate -U
 -DarchetypeGroupId=net.liftweb
 -DarchetypeArtifactId=lift-archetype-basic
 -DarchetypeVersion=1.0
 -DgroupId=de.inovex.jax2009.lift
 -DartifactId=lift-demo




                                              32
Projekt anlegen
$mvn archetype:generate -U
 -DarchetypeGroupId=net.liftweb
 -DarchetypeArtifactId=lift-archetype-basic
 -DarchetypeVersion=1.0
 -DgroupId=de.inovex.jax2009.lift
 -DartifactId=lift-demo


Import in Eclipse vorbereiten

$cd lift-demo && mvn eclipse:eclipse
                                              32
Projektlayout




                33
Projektlayout




                33
Projektlayout




                33
Ausführen




            34
Ausführen

$mvn jetty:run




                 34
Ausführen

$mvn jetty:run




                 34
index.html




             35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>




                                                  35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala




                                                  35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
default.html




               36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class=quot;containerquot;>
      <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;>
        <h1 class=quot;altquot;>lift-demo
             <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot;
                  src=quot;/images/ajax-loader.gifquot;/></h1>
      </div>
      <hr/>
      <div class=quot;column span-6 colborder sidebarquot;>
        <hr class=quot;spacequot; />
        <lift:Menu.builder />	
        <div>
          <lift:snippet type=quot;msgsquot;/>
          <hr class=quot;spacequot; />
        </div>
      </div>
      <div class=quot;column span-17 lastquot;>
        <lift:bind name=quot;contentquot; />
      </div>
      <hr />
      <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;>
        <h4 class=quot;altquot;>
           <a href=quot;http://liftweb.netquot;><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
Boot.scala




             37
Boot.scala
     def boot {
         if (!DB.jndiJdbcConnAvailable_?)
           DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)

        // where to search snippet
        LiftRules.addToPackages(quot;de.inovex.jax2009.liftquot;)

        // create or update the database schema
        Schemifier.schemify(true, Log.infoF _, User)

        // build site map
        val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: User.sitemap
        LiftRules.setSiteMap(SiteMap(entries:_*))

        // Show the spinny image when an Ajax call starts
        LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show(quot;ajax-loaderquot;).cmd)

        // Make the spinny image go away when it ends
        LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide(quot;ajax-loaderquot;).cmd)

        // force the request to be UTF-8
        LiftRules.early.append(makeUtf8)

         S.addAround(DB.buildLoanWrapper)
                                                                                          37
 }
Rekursive Template Komposition




                                 38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>




                                                    39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }


    // in boot.scala:
    val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) ::
                  Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) ::
                  User.sitemap
    LiftRules.setSiteMap(SiteMap(entries:_*))                               39
Formulare
    <lift:surround with=quot;defaultquot; at=quot;contentquot;>
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form=quot;POSTquot;>
	    	      <f:name><input type=quot;textquot;/></f:name>
	    	      <input type=quot;submitquot; value=quot;Postquot;/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_)))
      }
    }


    // in boot.scala:
    val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) ::
                  Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) ::
                  User.sitemap
    LiftRules.setSiteMap(SiteMap(entries:_*))                               39
Formulare




            40
Formulare




            40
Formulare




JAX 2009!
INFO - Service request (POST) /veryFirstForm took 61 Milliseconds

                                                                    40
Formulare




JAX 2009!
INFO - Service request (POST) /veryFirstForm took 61 Milliseconds

                                                                    40
more in Action ;)
                    41
Beispiel-Applikation(en)
  Scala Actors / Comet
  Modelle / OR-Mapping
  SiteMap
  Messages
  ...




                           42
Beispiel-Applikation(en)
  Scala Actors / Comet
  Modelle / OR-Mapping
  SiteMap
  Messages
  ...


              Demo !
                           42
Zusammenfassung
                  43
44
Pro
  Sehr schicke Sprachfeatures
  „Best of all“ Prinzip
  Junge und dynamische Community
  Sehr gut für interaktive Webbapplikationen („Real time web“)
  Native, volle JVM Geschwindigkeit
  100% kompatibel mit Java
  Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...)




                                                                 44
Pro
  Sehr schicke Sprachfeatures
  „Best of all“ Prinzip
  Junge und dynamische Community
  Sehr gut für interaktive Webbapplikationen („Real time web“)
  Native, volle JVM Geschwindigkeit
  100% kompatibel mit Java
  Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...)
Cons
  Steile Lernkurve
  Wenig Scala Ressourcen am Markt verfügbar (XING: 164)
  Noch weniger Lift Ressourcen verfügbar (XING: 3)
  Keine mir bekannten große Installationen aktuell vorzeigbar    44
Aktuell Roadmap 1.1 (Auszug der Lift Newsgroup)
   Improved documentation: better VScalaDoc coverage as well as better tutorial and
   cook-book documentation.
   Improved J2EE support including JTA and Portlets.
   Finish Record/Field code with backing store including JDBC, JPA and Goat Rodeo
   (what's Goat Rodeo? http://goatrodeo.org)
   Improved client-side JavaScript support and better JavaScript abstractions.
   Client/Server data synchronization (integrated with Record/Field)
   Improved support for REST.
   Improved performance including caching templates when running in production
   mode.
   OSGi support.
   Improved testing framework and better testing support when running in quot;testquot; mode.
   Implement Servlet 3.0 support.
   HTML 5 and Web Sockets support and integration with Kaazing's Web Sockets
   server. Also, sensing which browser is making the request and performing
   optimizations based on that browser's characteristics (specifically, Chrome and
                                                                                      45
   Firefox 3.1 support)
Ressourcen im Netz
  Scala
     http://scala-lang.org
  Lift
     http://liftweb.net/
     http://liftweb.net/docs/getting_started.html
     http://wiki.liftweb.net/
     http://github.com/dpp/liftweb
  Lift Buch: „Exploring Lift“
     http://groups.google.com/group/the-lift-book
     http://github.com/tjweir/liftbook/

                                                    46
Exploring Lift
      Mail 2009, oder LyX Version!
      Derek Chen-Becker,
      Tyler Weir, Marius Danciu
Beginning Scala
      Mail 2009
      David Pollak
Programming in Scala
      Martin Odersky,
      Lex Spoon, and Bill Venners
...
                                     47
Fragen & Antworten



                        Tobias Joch
                        System Architecture
                        Project Management


                        inovex GmbH
                        Karlsruher Straße 71
                        75179 Pforzheim

                        0173.3181 004
                        tobias.joch@inovex.de
                        www.inovex.de




Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
Vielen Dank! ;)



                        Tobias Joch
                        System Architecture
                        Project Management


                        inovex GmbH
                        Karlsruher Straße 71
                        75179 Pforzheim

                        0173.3181 004
                        tobias.joch@inovex.de
                        www.inovex.de




Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.

Weitere ähnliche Inhalte

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

GeLiftete Web-Applikation mit Scala - Tobias Joch - inovex GmbH

  • 1. GeLiftete Web-Applikation mit Scala JAX 2009 Tobias Joch inovex GmbH Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  • 2. Scala Lift Grundlagen Architektur Überblick Module Template Verarbeitung Tags und Snippets Head Merge Scopes I18n Persistenz AJAX in Action Fazit / Ausblick / weiterführende Informationen 2
  • 3. 3
  • 4. Scala = SCAlable LAnguage 4
  • 5. Scala = SCAlable LAnguage wächst mit den Bedürfnissen der User kleine Skripte bis hin zu großen und komplexen Systemen Multiparadigmensprache verbindet objektorientierte (imperative) und funktionale Programmierung pragmatisch, typsicher, strikt objektorientiert interoperabel mit Standard Plattformen (Java, .NET) 4
  • 6. Wurzeln reichen zurück in das Jahr 1995 Philip Wadler und Martin Odersky Funktionale Programmiersprachen für die JVM Pizza GJ (Generic Language Extension für Java) javac Java Generics 1999 verfolgte Martin Odersky das Ziel funktionale mit OO Programmierung zu kombinieren Funnel Scala *2001, 2003 erstes Public Release, 2006 Version 2.0, aktuell 2.7.4 RC1 5
  • 7. Ziel von Scala: Das Beste aus beiden Welten (OO und FP) Statisch typisiert + Typinferenz Funktionen höherer Ordnung Traits, Mixin-Komposition Option-Klasse (None und Some vs. null) Pattern Matching Algebraische Typen Native XML-Unterstützung inkl. XPath Unterstützung (Bibliothek) Actor Model Currying Anonyme Funktionen Parametrische Polymorphie 6
  • 8. Einige reservierte Schlüsselwörter in Scala class, case class, object new with extends abstract sealed trait def, var, val override match, case 7
  • 10. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 11. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 12. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 13. Imperative vs. funktionale Programmierung (I) public class Example1 { public static void main(String[] args) { for (String arg : args) { System.out.println(arg); } } } 10
  • 14. Imperative vs. funktionale Programmierung (I) public class Example1 { public static void main(String[] args) { for (String arg : args) { System.out.println(arg); } } } object Example1 { def main(args: Array[String]) { args.foreach(println) } } 10
  • 15. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith(quot;JAX09quot;)) { System.out.println(arg); } } } } 11
  • 16. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith(quot;JAX09quot;)) { System.out.println(arg); } } } } object Example2 { def main(args: Array[String]) { args.filter(_.startsWith(quot;JAX09quot;)).foreach(println) } } 11
  • 17. Imperative vs. funktionale Programmierung (III) public class Example3 { public static void main(String[] args) { boolean exists = false; for (String arg : args) { if (arg.startsWith(quot;JAX09quot;)) { exists = true; break; } } System.out.print(exists); } } 12
  • 18. Imperative vs. funktionale Programmierung (III) public class Example3 { public static void main(String[] args) { boolean exists = false; for (String arg : args) { if (arg.startsWith(quot;JAX09quot;)) { exists = true; break; } } System.out.print(exists); } } object Example3 { def main(args: Array[String]) { print(args.exists(_.startsWith(quot;JAX09quot;))) } } 12
  • 20. David Pollak Gründer von Lift Kommerzielle Softwareentwicklung seit 1977 Web-Applikationen seit 1996 15. Februar 2007: Initial Import (GitHub) in der Version 0.1.0 Gründung von Lift als OS Projekt in 2007 26. Februar 2009: Lift 1.0 Aktuelles Lift-Team besteht aus 13 Comitter Aktive Community http://groups.google.com/group/liftweb 14
  • 21. „Best of all“ Scala als zugrundeliegende Sprache nativer XML-Support (XHTML nativ innerhalb von Snippets!) Scala Actors für mächtige Comet-Anwendungen fein granulare Sessions und Security (Seaside) schnelles Projektsetup durch „convention over configuration“ + geringe Turnaround-Zeiten (Rails) Django's quot;more than just CRUD is includedquot; Designer freundliche Templates (Wicket / Lift View First) Offen für die Nutzung von zahlreichen OSS-Bibliotheken (Java) Etablierte Deployment-Prozesse (JEE / Java) 15
  • 22. Weitere Eigenschaften / Ziele von Lift Sicherheit XSS, replay Attacken, Parameter tampering Wartbarkeit Skalierbarkeit Performance Hohe Produktivität Einfach Convention over configuration DRY 16
  • 23. „View First“ Design-Prinzip Templates enthalten keinen Code Pures XHTML Können mit Standard Design-Werkzeugen bearbeitet werden Frontend ist ohne Scala-Kenntnisse von einem Designer realisierbar <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 17
  • 26. Lift-Framework Scala Framework 19
  • 27. Lift-Framework Lift-Framework Scala Framework 19
  • 28. Lift-Framework Lift Core Lift-Framework Scala Framework 19
  • 29. LiftSession LiftRules LiftResponse Lift-Framework S SHtml JS API Lift Core Lift Webkit SiteMap Menu, Msgs, Lift-Framework Scala Framework CSS HTTP Auth Comet 19
  • 30. LiftSession LiftRules Mapper LiftResponse Lift-Framework S SHtml Record JS API Lift Core Lift Webkit SiteMap Menu, Msgs, Lift-Framework Scala Framework CSS HTTP Auth Comet 19
  • 31. Lift-Framework Mapper Record Testkit LiftResponse Menu, Msgs, LiftSession HTTP Auth LiftRules SiteMap JS API SHtml Comet CSS S Lift Webkit Lift Core Lift-Framework Scala Framework 19
  • 32. Lift-Framework Mapper Record Testkit LiftResponse Menu, Msgs, LiftSession HTTP Auth LiftRules SiteMap JS API SHtml Comet CSS S Lift Webkit Lift Util Lift Core Lift-Framework Scala Framework 19
  • 33. Lift-Framework Lift XMPP Mapper Record Testkit Lift Facebook LiftResponse Menu, Msgs, LiftSession HTTP Auth Lift Widgets LiftRules SiteMap JS API SHtml Comet CSS S Lift OpenId Lift OAuth Lift Webkit Lift Paypal Lift Util Lift AMQP Lift Core Lift-Framework Scala Framework 19
  • 34. Grobe Architektur einer Lift-Applikation 20
  • 35. Grobe Architektur einer Lift-Applikation Java Virtual Machine 20
  • 36. Grobe Architektur einer Lift-Applikation Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 37. Grobe Architektur einer Lift-Applikation Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 38. Grobe Architektur einer Lift-Applikation Templates Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 39. Grobe Architektur einer Lift-Applikation Templates Snippets Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 40. Grobe Architektur einer Lift-Applikation Templates Snippets Views Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 41. Grobe Architektur einer Lift-Applikation Templates Snippets Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 42. Grobe Architektur einer Lift-Applikation Templates Snippets Model Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 43. Grobe Architektur einer Lift-Applikation Templates Snippets Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 44. Grobe Architektur einer Lift-Applikation Templates Snippets LiftServlet Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 45. Grobe Architektur einer Lift-Applikation Templates Snippets LiftServlet Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework DefaultServlet Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 46. Grober Ablauf einer Anfragenbearbeitung Request URL rewrite custom dispatch Template View Response Response Response Response 21
  • 47. Grober Ablauf einer Anfragenbearbeitung Template Request URL rewrite custom dispatch View Response Response Response Response 21
  • 48. Template Template Verarbeitung Request Mapping nach folgendem Schema 22
  • 49. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] 22
  • 50. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung 22
  • 51. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben 22
  • 52. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben Lift versteckt Templates und Ressourcen in Verzeichnissen welche als Endung -hidden im Namen tragen 22
  • 53. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben Lift versteckt Templates und Ressourcen in Verzeichnissen welche als Endung -hidden im Namen tragen 22
  • 54. Template 23
  • 55. Template Templates = Content + Tags + Snippets 23
  • 56. Template Templates = Content + Tags + Snippets Tags = Lift spezifische Funktionen surround bind embed comet loc 23
  • 57. Template Templates = Content + Tags + Snippets Tags = Lift spezifische Funktionen surround bind embed comet loc Snippets vergleichbar mit Taglibs <lift:snippet type=Jax:render /> <lift:Jax.render /> <lift:Jax /> 23
  • 58. Template Template Verarbeitung von Außen nach Innen 24
  • 59. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> 24
  • 60. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> 24
  • 61. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> Ausführung von HelloWorld#howdy 24
  • 63. Template Head Merge /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 25
  • 64. Template Head Merge /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> 25
  • 65. Template Head Merge /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> 25
  • 66. Scopes S Stateful Snippet RequestVar SessionVar Scala Object (Singleton) 26
  • 67. Internationalisierung / I18n java.util.Locale java.util.ResourceBundle LiftRules.resourceNames Ermittlung der aktuellen Sprache LiftRules.localeCalculator Request-Header Fallback: Locale.getDefault() Snippets S.? Templates <lift:loc locid=quot;liftquot;>Aufzug</lift:loc> <lift:loc>lift</lift:loc> 27
  • 68. Persistenz in Lift Mapper Record JPA JDO Hibernate ... Lift selbst ist Persistenz agnostisch 28
  • 69. AJAX in Lift SHtml ajaxButton ajaxText ajaxCheckbox ... def render(in: NodeSeq): NodeSeq = SHtml.ajaxButton(quot;Click me ;)quot;, () => { println(quot;Yes, thanks!quot;) JsCmds.SetHtml(quot;click-divquot;, Text(quot;Yes, thanks!quot;)) }) 29
  • 71. Entwicklungsumgebung Java (>= 5) Maven (>= 2.0.9) Web-Container (Jetty, Tomcat, ...) Optional, aber nützlich JavaRebel (JVM Plugin / Java Agent) IDE mit Scala Support / Plugin (Eclipse, IDEA, Netbeans, ...) http://www.scala-lang.org/scala-eclipse-plugin 31
  • 73. Projekt anlegen $mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=1.0 -DgroupId=de.inovex.jax2009.lift -DartifactId=lift-demo 32
  • 74. Projekt anlegen $mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=1.0 -DgroupId=de.inovex.jax2009.lift -DartifactId=lift-demo Import in Eclipse vorbereiten $cd lift-demo && mvn eclipse:eclipse 32
  • 82. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 35
  • 83. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala 35
  • 84. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 85. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 86. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 87. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 88. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 89. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 90. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 92. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 93. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 94. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 95. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 96. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 97. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 99. Boot.scala def boot { if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor) // where to search snippet LiftRules.addToPackages(quot;de.inovex.jax2009.liftquot;) // create or update the database schema Schemifier.schemify(true, Log.infoF _, User) // build site map val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) // Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show(quot;ajax-loaderquot;).cmd) // Make the spinny image go away when it ends LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide(quot;ajax-loaderquot;).cmd) // force the request to be UTF-8 LiftRules.early.append(makeUtf8) S.addAround(DB.buildLoanWrapper) 37 }
  • 101. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 102. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 103. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 104. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 105. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> 39
  • 106. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 107. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 108. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 109. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 110. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } // in boot.scala: val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  • 111. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } // in boot.scala: val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  • 112. Formulare 40
  • 113. Formulare 40
  • 114. Formulare JAX 2009! INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  • 115. Formulare JAX 2009! INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  • 116. more in Action ;) 41
  • 117. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... 42
  • 118. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... Demo ! 42
  • 120. 44
  • 121. Pro Sehr schicke Sprachfeatures „Best of all“ Prinzip Junge und dynamische Community Sehr gut für interaktive Webbapplikationen („Real time web“) Native, volle JVM Geschwindigkeit 100% kompatibel mit Java Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...) 44
  • 122. Pro Sehr schicke Sprachfeatures „Best of all“ Prinzip Junge und dynamische Community Sehr gut für interaktive Webbapplikationen („Real time web“) Native, volle JVM Geschwindigkeit 100% kompatibel mit Java Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...) Cons Steile Lernkurve Wenig Scala Ressourcen am Markt verfügbar (XING: 164) Noch weniger Lift Ressourcen verfügbar (XING: 3) Keine mir bekannten große Installationen aktuell vorzeigbar 44
  • 123. Aktuell Roadmap 1.1 (Auszug der Lift Newsgroup) Improved documentation: better VScalaDoc coverage as well as better tutorial and cook-book documentation. Improved J2EE support including JTA and Portlets. Finish Record/Field code with backing store including JDBC, JPA and Goat Rodeo (what's Goat Rodeo? http://goatrodeo.org) Improved client-side JavaScript support and better JavaScript abstractions. Client/Server data synchronization (integrated with Record/Field) Improved support for REST. Improved performance including caching templates when running in production mode. OSGi support. Improved testing framework and better testing support when running in quot;testquot; mode. Implement Servlet 3.0 support. HTML 5 and Web Sockets support and integration with Kaazing's Web Sockets server. Also, sensing which browser is making the request and performing optimizations based on that browser's characteristics (specifically, Chrome and 45 Firefox 3.1 support)
  • 124. Ressourcen im Netz Scala http://scala-lang.org Lift http://liftweb.net/ http://liftweb.net/docs/getting_started.html http://wiki.liftweb.net/ http://github.com/dpp/liftweb Lift Buch: „Exploring Lift“ http://groups.google.com/group/the-lift-book http://github.com/tjweir/liftbook/ 46
  • 125. Exploring Lift Mail 2009, oder LyX Version! Derek Chen-Becker, Tyler Weir, Marius Danciu Beginning Scala Mail 2009 David Pollak Programming in Scala Martin Odersky, Lex Spoon, and Bill Venners ... 47
  • 126. Fragen & Antworten Tobias Joch System Architecture Project Management inovex GmbH Karlsruher Straße 71 75179 Pforzheim 0173.3181 004 tobias.joch@inovex.de www.inovex.de Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  • 127. Vielen Dank! ;) Tobias Joch System Architecture Project Management inovex GmbH Karlsruher Straße 71 75179 Pforzheim 0173.3181 004 tobias.joch@inovex.de www.inovex.de Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.