O slideshow foi denunciado.

Jax2009 inovex-tjoch-lift-20090423

442 visualizações

Publicada em

Publicada em: Tecnologia, Educação
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Jax2009 inovex-tjoch-lift-20090423

  1. 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. 2. ScalaLift 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. 3
  4. 4. Scala = SCAlable LAnguage 4
  5. 5. Scala = SCAlable LAnguagewächst mit den Bedürfnissen der Userkleine Skripte bis hin zu großen und komplexenSystemenMultiparadigmensprache verbindet objektorientierte (imperative) und funktionale Programmierungpragmatisch, typsicher, strikt objektorientiertinteroperabel mit Standard Plattformen (Java, .NET) 4
  6. 6. Wurzeln reichen zurück in das Jahr 1995Philip Wadler und Martin Odersky Funktionale Programmiersprachen für die JVM Pizza GJ (Generic Language Extension für Java) javac Java Generics1999 verfolgte Martin Odersky das Ziel funktionale mitOO Programmierung zu kombinieren Funnel Scala *2001, 2003 erstes Public Release, 2006 Version 2.0, aktuell 2.7.4 RC1 5
  7. 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. 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
  9. 9. in Action ;) 8
  10. 10. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  11. 11. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  12. 12. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  13. 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. 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. 15. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith("JAX09")) { System.out.println(arg); } } } } 11
  16. 16. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith("JAX09")) { System.out.println(arg); } } } } object Example2 { def main(args: Array[String]) { args.filter(_.startsWith("JAX09")).foreach(println) } } 11
  17. 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("JAX09")) { exists = true; break; } } System.out.print(exists); } } 12
  18. 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("JAX09")) { exists = true; break; } } System.out.print(exists); } } object Example3 { def main(args: Array[String]) { print(args.exists(_.startsWith("JAX09"))) } } 12
  19. 19. Grundlagen 13
  20. 20. David Pollak Gründer von Lift Kommerzielle Softwareentwicklung seit 1977 Web-Applikationen seit 199615. Februar 2007:Initial Import (GitHub) in der Version 0.1.0Gründung von Lift als OS Projekt in 200726. Februar 2009:Lift 1.0Aktuelles Lift-Team besteht aus 13 ComitterAktive Community http://groups.google.com/group/liftweb 14
  21. 21. „Best of all“Scala als zugrundeliegende Sprache nativer XML-Support (XHTML nativ innerhalb von Snippets!) Scala Actors für mächtige Comet-Anwendungenfein granulare Sessions und Security (Seaside)schnelles Projektsetup durch „convention overconfiguration“ + geringe Turnaround-Zeiten (Rails)Djangos "more than just CRUD is included"Designer freundliche Templates (Wicket / Lift View First)Offen für die Nutzung von zahlreichen OSS-Bibliotheken(Java)Etablierte Deployment-Prozesse (JEE / Java) 15
  22. 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. 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="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 17
  24. 24. Architektur Überblick 18
  25. 25. Lift-Framework 19
  26. 26. Lift-Framework Scala Framework 19
  27. 27. Lift-Framework Lift-Framework Scala Framework 19
  28. 28. Lift-Framework Lift Core Lift-Framework Scala Framework 19
  29. 29. LiftSession LiftRules LiftResponse Lift-Framework S SHtml JS API Lift Core Lift Webkit SiteMap Menu, Msgs, Lift-Framework Scala Framework CSS HTTP Auth Comet19
  30. 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 Comet19
  31. 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. 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. 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 Webkit Lift OAuth Lift Util Lift Paypal Lift Core Lift AMQP Lift-Framework Scala Framework 19
  34. 34. Grobe Architektur einer Lift-Applikation 20
  35. 35. Grobe Architektur einer Lift-Applikation Java Virtual Machine 20
  36. 36. Grobe Architektur einer Lift-Applikation Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  37. 37. Grobe Architektur einer Lift-Applikation Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  38. 38. Grobe Architektur einer Lift-Applikation Templates Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  39. 39. Grobe Architektur einer Lift-Applikation Templates Snippets Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  40. 40. Grobe Architektur einer Lift-Applikation Templates Snippets Views Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  41. 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. 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. 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. 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. 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. 46. Grober Ablauf einer AnfragenbearbeitungRequest URL rewrite custom dispatch Template View Response Response Response Response 21
  47. 47. Grober Ablauf einer Anfragenbearbeitung TemplateRequest URL rewrite custom dispatch View Response Response Response Response 21
  48. 48. TemplateTemplate Verarbeitung Request Mapping nach folgendem Schema 22
  49. 49. TemplateTemplate Verarbeitung Request Mapping nach folgendem Schema<path>[_<language, optional>][.<suffix>] 22
  50. 50. TemplateTemplate Verarbeitung Request Mapping nach folgendem Schema<path>[_<language, optional>][.<suffix>]Lift wählt die passende Sprache und Endung 22
  51. 51. TemplateTemplate 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. 52. TemplateTemplate Verarbeitung Request Mapping nach folgendem Schema<path>[_<language, optional>][.<suffix>]Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angebenLift versteckt Templates undRessourcen in Verzeichnissenwelche als Endung -hidden imNamen tragen 22
  53. 53. TemplateTemplate Verarbeitung Request Mapping nach folgendem Schema<path>[_<language, optional>][.<suffix>]Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angebenLift versteckt Templates undRessourcen in Verzeichnissenwelche als Endung -hidden imNamen tragen 22
  54. 54. Template 23
  55. 55. TemplateTemplates = Content + Tags + Snippets 23
  56. 56. TemplateTemplates = Content + Tags + SnippetsTags = Lift spezifische Funktionen surround bind embed comet loc 23
  57. 57. TemplateTemplates = Content + Tags + SnippetsTags = Lift spezifische Funktionen surround bind embed comet locSnippets vergleichbar mit Taglibs <lift:snippet type=Jax:render /> <lift:Jax.render /> <lift:Jax /> 23
  58. 58. › Template Template Verarbeitung von Außen nach Innen 24
  59. 59. › Template Template Verarbeitung von Außen nach Innen/index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> 24
  60. 60. › Template Template Verarbeitung von Außen nach Innen/index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround>/templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 24
  61. 61. › Template Template Verarbeitung von Außen nach Innen/index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround>/templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> Ausführung von HelloWorld#howdy 24
  62. 62. TemplateHead Merge 25
  63. 63. Template Head Merge/index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 25
  64. 64. Template Head Merge/index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround>/templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 25
  65. 65. Template Head Merge/index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround>/templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 25
  66. 66. Scopes S Stateful Snippet RequestVar SessionVar Scala Object (Singleton) 26
  67. 67. Internationalisierung / I18n java.util.Locale java.util.ResourceBundle LiftRules.resourceNamesErmittlung der aktuellen Sprache LiftRules.localeCalculator Request-Header Fallback: Locale.getDefault()Snippets S.?Templates<lift:loc locid="lift">Aufzug</lift:loc><lift:loc>lift</lift:loc> 27
  68. 68. Persistenz in Lift Mapper Record JPA JDO Hibernate ...Lift selbst ist Persistenz agnostisch 28
  69. 69. AJAX in Lift SHtml ajaxButton ajaxText ajaxCheckbox ...def render(in: NodeSeq): NodeSeq = SHtml.ajaxButton("Click me ;)", () => { println("Yes, thanks!") JsCmds.SetHtml("click-div", Text("Yes, thanks!")) }) 29
  70. 70. in Action ;) 30
  71. 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
  72. 72. Projekt anlegen 32
  73. 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. 74. Projekt anlegen$mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=1.0 -DgroupId=de.inovex.jax2009.lift -DartifactId=lift-demoImport in Eclipse vorbereiten$cd lift-demo && mvn eclipse:eclipse 32
  75. 75. Projektlayout 33
  76. 76. Projektlayout 33
  77. 77. Projektlayout 33
  78. 78. Ausführen 34
  79. 79. Ausführen$mvn jetty:run 34
  80. 80. Ausführen$mvn jetty:run 34
  81. 81. index.html 35
  82. 82. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 35
  83. 83. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala 35
  84. 84. index.html <lift:surround with="default" at="content"> <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. 85. index.html <lift:surround with="default" at="content"> <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. 86. index.html <lift:surround with="default" at="content"> <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. 87. index.html <lift:surround with="default" at="content"> <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. 88. index.html <lift:surround with="default" at="content"> <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. 89. index.html <lift:surround with="default" at="content"> <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. 90. index.html <lift:surround with="default" at="content"> <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
  91. 91. default.html 36
  92. 92. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  93. 93. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  94. 94. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  95. 95. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  96. 96. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  97. 97. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  98. 98. Boot.scala 37
  99. 99. Boot.scala def boot { if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor) // where to search snippet LiftRules.addToPackages("de.inovex.jax2009.lift") // create or update the database schema Schemifier.schemify(true, Log.infoF _, User) // build site map val entries = Menu(Loc("Home", List("index"), "Home")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) // Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) // Make the spinny image go away when it ends LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd) // force the request to be UTF-8 LiftRules.early.append(makeUtf8) S.addAround(DB.buildLoanWrapper) } 37
  100. 100. Rekursive Template Komposition 38
  101. 101. Rekursive Template Kompositionclass HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span>} 38
  102. 102. Rekursive Template Kompositionclass HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span>} 38
  103. 103. Rekursive Template Kompositionclass HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span>} 38
  104. 104. Rekursive Template Kompositionclass HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span>} 38
  105. 105. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> 39
  106. 106. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  107. 107. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  108. 108. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  109. 109. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  110. 110. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } // in boot.scala: val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("form1", List("veryFirstForm"), "Example")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  111. 111. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } // in boot.scala: val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("form1", List("veryFirstForm"), "Example")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  112. 112. Formulare 40
  113. 113. Formulare 40
  114. 114. FormulareJAX 2009!INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  115. 115. FormulareJAX 2009!INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  116. 116. more in Action ;) 41
  117. 117. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... 42
  118. 118. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... Demo ! 42
  119. 119. Zusammenfassung 43
  120. 120. 44
  121. 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. 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. 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 (whats 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 "test" mode. Implement Servlet 3.0 support. HTML 5 and Web Sockets support and integration with Kaazings Web Sockets server. Also, sensing which browser is making the request and performing optimizations based on that browsers characteristics (specifically, Chrome and Firefox 3.1 support) 45
  124. 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. 125. Exploring Lift Mail 2009, oder LyX Version! Derek Chen-Becker, Tyler Weir, Marius DanciuBeginning Scala Mail 2009 David PollakProgramming in Scala Martin Odersky, Lex Spoon, and Bill Venners... 47
  126. 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.deWir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  127. 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.deWir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.

×