SlideShare a Scribd company logo
1 of 49
Download to read offline
1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
How Wicket, Scala, and
Java EE Can Improve
Web Development
Bruno Borges
Oracle Product Manager for Latin America
Java EE, GlassFish, WebLogic, Coherence



2   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Who am I?
        Bruno Borges


           Java developer since 2000
           Speaker at Conferences
                    – JustJava, JavaOne Brazil, The Developers Conference, ApacheCon
           Evangelized Apache Camel and Apache Wicket in Brazil
           Joined Oracle on July 2012
                    – Product Manager for Java EE, GlassFish and WebLogic
           Married, lives in Sao Paulo, has a Golden Retriever, hiker and gamer



3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Agenda


         All about Web Development
         Apache Wicket Overview
         Introducing Scala and the Gamboa Wicket DSL
         Java EE for everything
         The Gamboa Project



4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
All About Web
        Development




5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Web designing process and tools
        Mock, draw, code




7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
PREVIEW
                                                                           IN THE
            BROWSER
8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
All about Web Development
        How do we build web sites and applications?


           There are two ways to build web applications
                    – bottom-up
                                  Mock up interfaces, develop using a web framework, apply design
                    – top-down
                                  Design pixel-perfect prototype, adapt prototype to a web framework,
           There’s no web framework able to do both… productively speaking
           Pixel-perfect websites vs functional websites



9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Outside the Java Web Framework Land
         What are the technologies people use to build pixel-perfect sites?


            Ruby on Rails
            PHP
            Python
                     – Django Framework
            JavaScript + REST
                     – ExtJS
                     – jQuery




10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What about functional websites?
         Component-based frameworks work better


            Java Server Faces
            GWT, Vaadin
            Apache Wicket
            others


            Better use the bottom up design strategy




11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java Frameworks for Pixel Perfect Websites
         Frameworks that are good for pixel-perfect websites


            JSP / Servlets
            Struts 2, Tapestry, Wicket
            Java Server Faces, specifically Facelets
            Play!, Lift
            others


            Better use the top down design strategy



12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What if we could have a framework that doesn’t force us
         to totally modify the work of a Web Designer for
         prototype?




13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Imperative vs Declarative HTML Markup
         What is the best HTML markup for pixel-perfect websites?


            Pixel-perfect websites are always top-down
                     – A lot of work to add server-side code to the prototype
                     – And it would be good for web designers to continue to have a functional
                             prototype after server-side code is added


            Imperative
                     – Must change from raw HTML markup to specific web framework markup
            Declarative
                     – Annotates markup to be accessed, and modified, later by the framework

14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Imperative Markup

          Before
          <form action=”save”>
            <input type=”text” name=”name” />
            <input type=”submit” value=”Save” />
          </form>
          After, using Apache Struts
          <s:form action=”save”>
            <s:input property=”name” />
            <s:submit value=”Save” />
          </s:form>



15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Does it run on the browser?
         Not really…


            Imperative frameworks that modify the prototype
                     – Web designers loose ability to preview in the browser
                     – They must install, configure and run
                                   Servlet containers, Ruby, or PHP servers


            You really don’t want web designers touching server-side code
            Specially programmers modifying HTML or CSS elements to fix things



16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Declarative Markup

          Before
          <form action=”save”>
            <input type=”text” name=”name” />
            <input type=”submit” value=”Save” />
          </form>
          After, using Apache Wicket
          <form wicket:id=”form”>
            <input type=”text” wicket:id=”name” />
            <input type=”submit” value=”Save” wicket:id=”save” />
          </form>



17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Programmers and Developers
         Happily Ever After…


            Programmers focused on server-side programming
            Web Designers able to modify client-side without messing server-side
            Preview in the browser


            Customer happy to see (statically) how the application is progressing
                     – Open Firefox, go to file:///home/customer/project/web/index.html




18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Apache Wicket
         Quick overview




19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
HTML Prototype
         The final product from the Web Designer


            /MyHomePage.html
                      <html>
                        <head><title>Apache Wicket</title></head>
                        <body>
                          <span>some message</span>
                          <form>
                            Name: <input type=”text” />
                            Email: <input type=”text” />
                            <input type=”submit” value=”Send” />
                          </form>
                        </body>
                      </html>


20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
HTML Prototype
         The final product from the Web Designer


            /MyHomePage.html
                      <html>
                        <head><title>Apache Wicket</title></head>
                        <body>
                          <span wicket:id=”msg”>some message</span>
                          <form wicket:id=”form”>
                            Name: <input type=”text” wicket:id=”name” />
                            Email: <input type=”text” wicket:id=”email” />
                            <input type=”submit” value=”Send” />
                          </form>
                        </body>
                      </html>


21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java side
         Where all the magic happens, object oriented


           /MyHomePage.java
            public class MyHomePage extends WebPage {
              public HomePage() {
                add(new Label(“msg”, “JavaOne”));
                Form form = new Form(“form”) {
                  public void onSubmit() { usrBean.salvar(getModelObject());
                }};
                form.add(new TextField(“name”));
                form.add(new TextField(“email”));
                form.setModel(new CompoundPropertyModel(new User()));
                add(form);
              }
            }
22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Easily Extensible


                 Just add the JAR with extra
                components to the classpath


            Gmap2 gmap = new Gmap2(“map”);
            page.add(gmap);
            <div wicket:id=”map”>
              Google Maps
            </div>



23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Apache Wicket
         And so many other features


            jQuery as its client-side engine for
                     – Core components
                     – Ajax
                     – WebSockets
            Page composition by: Inheritance, Borders and Panels
            Integration with CDI
            Back button support
            Several components, and also the WicketStuff Community


24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language




25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language
         Quick introduction


            Object Oriented and Functional Language
                                                                               var foo = 8
            Runs on JVM                                                       foo = “bar”
            Statically typed
            Compiles to Java byte code (sweeeet)
            Extensible                                                     Type mismatch;
                                                                            found: String(“bar”)
            Easy to define custom DSLs                                     required: Int




26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language
         Functions


            They are objects as well

                val func = () ⇒ println(“functional programming”)

                def callF(paramF: () ⇒ Unit) = paramF()

                callF(func)




27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language
         Very smart constructions


            They may seem complex, but you get used to them


               val list1to9 = 1 to 9 toList

                for (i ← list1to9) {
                  print(i)
                }

                list1to9.foreach(i ⇒ print(i))

28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language
         Very smart constructions


               val listA =                                                  List(1, 2)
               val listB =                                                  List(3, 4)
               val listC =                                                  listA :: listB
               // listC is                                                  a new List object

                val listD = listC :: 5
                print(listD)
                // output: List(1,2,3,4,5)



29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Scala Language
         Very smart constructions


            val map = new HashMap[Int, String]
              map += 1 → "Number 1"
              map += 2 → "Number 2"
              map += 3 → "Number 3"
              println(map(2))
              // '2' is the key, not the index!

                      val romans = Map(1 → "I", 2 → "II", 3 → "III", 4 →
                      "IV", 5 → "V")
                      println(romanNumeral(4)) // outputs: "IV"

30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Back to Wicket
         Strong use of anonymous classes


            Wicket programming model resembles Swing
            Pushes developers to use anonymous, inner classes


            Functional programming fits quite well into this model
            Less code, less verbosity


            Scala #win



31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Wicket + Scala: perfect combination
         Before, in Java
           /MyHomePage.java
            public class MyHomePage extends WebPage {
              @Inject private MyService service;
              public MyHomePage() {
                add(new Label(“msg”, “JavaOne”));
                Form form = new Form(“form”, new CompoudPropertyModel(new User())){
                   public void onSubmit() {
                     service.update(getModelObject());
                   }
                };
                form.add(new TextField(“name”));
                form.add(new TextField(“email”));
                add(form);
              }
            }

32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Wicket + Scala: perfect combination
         Now, with Scala
            /MyHomePage.scala
               class MyHomePage extends WebPage {
                 @Inject var service: MyService = _
                 add(new Label(“msg”, “JavaOne”))
                 object form extends Form(“form”,
                      new CompoundPropertyModel(new User())) {
                   add(new TextField(“name”))
                   add(new TextField(“email”))
                   override def onSubmit() = {
                     service.update(getModelObject())
                   }
                 }
                 add(form)
               }




33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Wicket + Scala: perfect combination
         Now with specific Scala DSL for Wicket
            /MyHomePage.scala
               class MyHomePage extends WebPage with DSLWicket {
                 @Inject var service: MyService = _
                 label(“msg”, “JavaOne”)
                 val f = form(“form”, () ⇒ service.update(f.mobject))
                 f.scmodel(new User())
                 f.textField[String](“name”)
                 f.textField[String](“email”)
               }




34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java EE
         for everything else




35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java EE 6
         Filling the necessary gaps, extraordinarily well


            Enterprise Java Beans
            Contexts and Dependency Injection
            Java Persistent API
            Java Transaction API
            Bean Validation
            JAX-RS




36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
And more stuff
         Like…


            GlassFish Maven Embedded Plugin
            Derby DB
            No more web.xml
                     – Servlet 3.0 is awesome
            Getters/Setters generated
                     – Scala’s @BeanProperty annotation




37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
No more web.xml
         Servlet 3 and Scala

                package code.webapp

                import javax.servlet.annotation.{ WebFilter, WebInitParam }
                import org.apache.wicket.protocol.http.WicketFilter

                @WebFilter(value = Array("/*"), initParams = Array(
                   new WebInitParam(name="applicationClassName", value="code.webapp.Application"),
                   new WebInitParam(name="filterMappingUrlPattern", value = "/*“)
                ))

                class GamboaApplication extends WicketFilter




38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Getters/Setters generated
         Scala’s @BeanProperty annotation

           package code.data


           import scala.reflect.BeanProperty
           import javax.persistence.{ Id, GeneratedValue }


           trait Identifiable extends Serializable {
                @Id @GeneratedValue @BeanProperty var id: String = _
           }




39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Getters/Setters generated
         Scala’s @BeanProperty annotation


                package code.data

                import scala.reflect.BeanProperty
                import javax.persistence.{ Entity, Table }

                @Entity
                @Table(name = “USERS”)
                class User extends Identifiable {
                   @BeanProperty var name: String = _
                   @BeanProperty var email: String = _
                }




40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Gamboa Project
         Great architecture, written an archetype must be!




                                                                                 Apache Wicket
                                                                                    + Java EE 6
                                                                                        + Scala
                                                                            Gamboa Project
                                                                            www.gamboa-project.org


41   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Gamboa Project
         Maven archetypes


            Scala DSL for Wicket
            3 archetypes
                     – Java EE archetype
                                   JPA, CDI, EJB3, GlassFish Maven Plugin integrated
                     – Spring with CouchDB
                     – Spring with MongoDB
                                   Both integrated with Jetty plugin
            Directory structure simplified for Web development
                     – Not really “Maven convention”, for good reason
42   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Gamboa Project
         Directory Structure: simplified for Web development
           myproject $> tree
            |-- src --> .scala files
            | `-- code
            |    |-- web
            |    |-- services
            |    `-- email
            |-- config        --> configuration files
            | `-- email
            |-- layout        --> .html files and presentation
            | |-- css
            | `-- js
            |    `-- libs
            `-- pom.xml
43   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Gamboa Demo
         Group Birthday




44   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Next time you choose a web framework, think not only
          about features, but also about the web development
          process and the type of website you are going to build.




45   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
QUESTIONS?




46   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
THANK YOU!
         @brunoborges
         blogs.oracle.com/brunoborges




47   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The preceding is intended to outline our general product direction. It is intended
         for information purposes only, and may not be incorporated into any contract.
         It is not a commitment to deliver any material, code, or functionality, and should
         not be relied upon in making purchasing decisions. The development, release,
         and timing of any features or functionality described for Oracle’s products
         remains at the sole discretion of Oracle.




48   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
49   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

More Related Content

What's hot

[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web IntegrationKazuchika Sekiya
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Reza Rahman
 
Java EE 7 and HTML5: Developing for the Cloud
Java EE 7 and HTML5: Developing for the CloudJava EE 7 and HTML5: Developing for the Cloud
Java EE 7 and HTML5: Developing for the CloudArun Gupta
 
XML and Web Services with Groovy
XML and Web Services with GroovyXML and Web Services with Groovy
XML and Web Services with GroovyPaul King
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev TricksGabriel Walt
 
Wicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWill Hoover
 
Alexander Zeng
Alexander ZengAlexander Zeng
Alexander ZengAlex Zeng
 
Testdrive AngularJS with Spring 4
Testdrive AngularJS with Spring 4Testdrive AngularJS with Spring 4
Testdrive AngularJS with Spring 4Oliver Wahlen
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014Ryan Cuprak
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Edward Burns
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishArun Gupta
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondOracle
 

What's hot (20)

[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration
 
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
JavaCro'14 - Vaadin web application integration for Enterprise systems – Pete...
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
 
Websocket 1.0
Websocket 1.0Websocket 1.0
Websocket 1.0
 
Java EE 7 and HTML5: Developing for the Cloud
Java EE 7 and HTML5: Developing for the CloudJava EE 7 and HTML5: Developing for the Cloud
Java EE 7 and HTML5: Developing for the Cloud
 
XML and Web Services with Groovy
XML and Web Services with GroovyXML and Web Services with Groovy
XML and Web Services with Groovy
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
 
Wicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On Time
 
Alexander Zeng
Alexander ZengAlexander Zeng
Alexander Zeng
 
Testdrive AngularJS with Spring 4
Testdrive AngularJS with Spring 4Testdrive AngularJS with Spring 4
Testdrive AngularJS with Spring 4
 
Technical trainings
Technical trainingsTechnical trainings
Technical trainings
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
 
JavaCro'14 - Hybrid mobile apps – deploy Java web application on Android to r...
JavaCro'14 - Hybrid mobile apps – deploy Java web application on Android to r...JavaCro'14 - Hybrid mobile apps – deploy Java web application on Android to r...
JavaCro'14 - Hybrid mobile apps – deploy Java web application on Android to r...
 
Jd greece-2012-joomla-community-abc
Jd greece-2012-joomla-community-abcJd greece-2012-joomla-community-abc
Jd greece-2012-joomla-community-abc
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
 
Java EE 7 overview
Java EE 7 overviewJava EE 7 overview
Java EE 7 overview
 

Similar to How Scala, Wicket, and Java EE Can Improve Web Development

10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013Martin Fousek
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesMert Çalışkan
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Max Andersen
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Consuming Java EE in Desktop, Web, and Mobile Frontends
Consuming Java EE in Desktop, Web, and Mobile FrontendsConsuming Java EE in Desktop, Web, and Mobile Frontends
Consuming Java EE in Desktop, Web, and Mobile FrontendsGeertjan Wielenga
 
Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Petr Jiricka
 
Wso2 product release webinar introducing jaggery
Wso2 product release webinar   introducing jaggeryWso2 product release webinar   introducing jaggery
Wso2 product release webinar introducing jaggeryWSO2
 
Week 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuWeek 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuAppUniverz Org
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on RailsViridians
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationFredrik Öhrström
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_daviddTakashi Ito
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production EnvironmentsBruno Borges
 
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)David Delabassee
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! David Delabassee
 

Similar to How Scala, Wicket, and Java EE Can Improve Web Development (20)

10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 201310 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
10 Tips for Java EE 7 with PrimeFaces - JavaOne 2013
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Marcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL WorkbenchMarcin Szałowicz - MySQL Workbench
Marcin Szałowicz - MySQL Workbench
 
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
JavaCro'14 - Consuming Java EE Backends in Desktop, Web, and Mobile Frontends...
 
Consuming Java EE in Desktop, Web, and Mobile Frontends
Consuming Java EE in Desktop, Web, and Mobile FrontendsConsuming Java EE in Desktop, Web, and Mobile Frontends
Consuming Java EE in Desktop, Web, and Mobile Frontends
 
Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7
 
Sightly_techInsight
Sightly_techInsightSightly_techInsight
Sightly_techInsight
 
Wso2 product release webinar introducing jaggery
Wso2 product release webinar   introducing jaggeryWso2 product release webinar   introducing jaggery
Wso2 product release webinar introducing jaggery
 
Week 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuWeek 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. Wu
 
Viridians on Rails
Viridians on RailsViridians on Rails
Viridians on Rails
 
Java ee7 1hour
Java ee7 1hourJava ee7 1hour
Java ee7 1hour
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
 
Oracle JET overview
Oracle JET overviewOracle JET overview
Oracle JET overview
 
Karim mahmoud cv
Karim mahmoud cvKarim mahmoud cv
Karim mahmoud cv
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
 
GlassFish in Production Environments
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
 
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
 
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur! Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
 

More from Bruno Borges

Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesBruno Borges
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on KubernetesBruno Borges
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsBruno Borges
 
Making Sense of Serverless Computing
Making Sense of Serverless ComputingMaking Sense of Serverless Computing
Making Sense of Serverless ComputingBruno Borges
 
Visual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersVisual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersBruno Borges
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudTaking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudBruno Borges
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...Bruno Borges
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemMelhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemBruno Borges
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemBruno Borges
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudBruno Borges
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXBruno Borges
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Bruno Borges
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Bruno Borges
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Bruno Borges
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Bruno Borges
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Bruno Borges
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Bruno Borges
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the CloudBruno Borges
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXTweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXBruno Borges
 
Integrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsIntegrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsBruno Borges
 

More from Bruno Borges (20)

Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX AppsFrom GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
 
Making Sense of Serverless Computing
Making Sense of Serverless ComputingMaking Sense of Serverless Computing
Making Sense of Serverless Computing
 
Visual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring DevelopersVisual Studio Code for Java and Spring Developers
Visual Studio Code for Java and Spring Developers
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure CloudTaking Spring Apps for a Spin on Microsoft Azure Cloud
Taking Spring Apps for a Spin on Microsoft Azure Cloud
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na NuvemMelhore o Desenvolvimento do Time com DevOps na Nuvem
Melhore o Desenvolvimento do Time com DevOps na Nuvem
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The Cloud
 
Migrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFXMigrating From Applets to Java Desktop Apps in JavaFX
Migrating From Applets to Java Desktop Apps in JavaFX
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?Servidores de Aplicação: Por quê ainda precisamos deles?
Servidores de Aplicação: Por quê ainda precisamos deles?
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]Running Oracle WebLogic on Docker Containers [BOF7537]
Running Oracle WebLogic on Docker Containers [BOF7537]
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the Cloud
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFXTweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
 
Integrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSocketsIntegrando Oracle BPM com Java EE e WebSockets
Integrando Oracle BPM com Java EE e WebSockets
 

How Scala, Wicket, and Java EE Can Improve Web Development

  • 1. 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 2. How Wicket, Scala, and Java EE Can Improve Web Development Bruno Borges Oracle Product Manager for Latin America Java EE, GlassFish, WebLogic, Coherence 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 3. Who am I? Bruno Borges  Java developer since 2000  Speaker at Conferences – JustJava, JavaOne Brazil, The Developers Conference, ApacheCon  Evangelized Apache Camel and Apache Wicket in Brazil  Joined Oracle on July 2012 – Product Manager for Java EE, GlassFish and WebLogic  Married, lives in Sao Paulo, has a Golden Retriever, hiker and gamer 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4. Agenda  All about Web Development  Apache Wicket Overview  Introducing Scala and the Gamboa Wicket DSL  Java EE for everything  The Gamboa Project 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 5. All About Web Development 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6. 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7. Web designing process and tools Mock, draw, code 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8. PREVIEW IN THE BROWSER 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. All about Web Development How do we build web sites and applications?  There are two ways to build web applications – bottom-up  Mock up interfaces, develop using a web framework, apply design – top-down  Design pixel-perfect prototype, adapt prototype to a web framework,  There’s no web framework able to do both… productively speaking  Pixel-perfect websites vs functional websites 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Outside the Java Web Framework Land What are the technologies people use to build pixel-perfect sites?  Ruby on Rails  PHP  Python – Django Framework  JavaScript + REST – ExtJS – jQuery 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11. What about functional websites? Component-based frameworks work better  Java Server Faces  GWT, Vaadin  Apache Wicket  others  Better use the bottom up design strategy 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12. Java Frameworks for Pixel Perfect Websites Frameworks that are good for pixel-perfect websites  JSP / Servlets  Struts 2, Tapestry, Wicket  Java Server Faces, specifically Facelets  Play!, Lift  others  Better use the top down design strategy 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. What if we could have a framework that doesn’t force us to totally modify the work of a Web Designer for prototype? 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. Imperative vs Declarative HTML Markup What is the best HTML markup for pixel-perfect websites?  Pixel-perfect websites are always top-down – A lot of work to add server-side code to the prototype – And it would be good for web designers to continue to have a functional prototype after server-side code is added  Imperative – Must change from raw HTML markup to specific web framework markup  Declarative – Annotates markup to be accessed, and modified, later by the framework 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. Imperative Markup Before <form action=”save”> <input type=”text” name=”name” /> <input type=”submit” value=”Save” /> </form> After, using Apache Struts <s:form action=”save”> <s:input property=”name” /> <s:submit value=”Save” /> </s:form> 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. Does it run on the browser? Not really…  Imperative frameworks that modify the prototype – Web designers loose ability to preview in the browser – They must install, configure and run  Servlet containers, Ruby, or PHP servers  You really don’t want web designers touching server-side code  Specially programmers modifying HTML or CSS elements to fix things 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. Declarative Markup Before <form action=”save”> <input type=”text” name=”name” /> <input type=”submit” value=”Save” /> </form> After, using Apache Wicket <form wicket:id=”form”> <input type=”text” wicket:id=”name” /> <input type=”submit” value=”Save” wicket:id=”save” /> </form> 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 18. Programmers and Developers Happily Ever After…  Programmers focused on server-side programming  Web Designers able to modify client-side without messing server-side  Preview in the browser  Customer happy to see (statically) how the application is progressing – Open Firefox, go to file:///home/customer/project/web/index.html 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. Apache Wicket Quick overview 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. HTML Prototype The final product from the Web Designer /MyHomePage.html <html> <head><title>Apache Wicket</title></head> <body> <span>some message</span> <form> Name: <input type=”text” /> Email: <input type=”text” /> <input type=”submit” value=”Send” /> </form> </body> </html> 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. HTML Prototype The final product from the Web Designer /MyHomePage.html <html> <head><title>Apache Wicket</title></head> <body> <span wicket:id=”msg”>some message</span> <form wicket:id=”form”> Name: <input type=”text” wicket:id=”name” /> Email: <input type=”text” wicket:id=”email” /> <input type=”submit” value=”Send” /> </form> </body> </html> 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. Java side Where all the magic happens, object oriented /MyHomePage.java public class MyHomePage extends WebPage { public HomePage() { add(new Label(“msg”, “JavaOne”)); Form form = new Form(“form”) { public void onSubmit() { usrBean.salvar(getModelObject()); }}; form.add(new TextField(“name”)); form.add(new TextField(“email”)); form.setModel(new CompoundPropertyModel(new User())); add(form); } } 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. Easily Extensible  Just add the JAR with extra components to the classpath Gmap2 gmap = new Gmap2(“map”); page.add(gmap); <div wicket:id=”map”> Google Maps </div> 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24. Apache Wicket And so many other features  jQuery as its client-side engine for – Core components – Ajax – WebSockets  Page composition by: Inheritance, Borders and Panels  Integration with CDI  Back button support  Several components, and also the WicketStuff Community 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25. Scala Language 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26. Scala Language Quick introduction  Object Oriented and Functional Language var foo = 8  Runs on JVM foo = “bar”  Statically typed  Compiles to Java byte code (sweeeet)  Extensible Type mismatch; found: String(“bar”)  Easy to define custom DSLs required: Int 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27. Scala Language Functions  They are objects as well val func = () ⇒ println(“functional programming”) def callF(paramF: () ⇒ Unit) = paramF() callF(func) 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28. Scala Language Very smart constructions  They may seem complex, but you get used to them val list1to9 = 1 to 9 toList for (i ← list1to9) { print(i) } list1to9.foreach(i ⇒ print(i)) 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29. Scala Language Very smart constructions val listA = List(1, 2) val listB = List(3, 4) val listC = listA :: listB // listC is a new List object val listD = listC :: 5 print(listD) // output: List(1,2,3,4,5) 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30. Scala Language Very smart constructions val map = new HashMap[Int, String] map += 1 → "Number 1" map += 2 → "Number 2" map += 3 → "Number 3" println(map(2)) // '2' is the key, not the index! val romans = Map(1 → "I", 2 → "II", 3 → "III", 4 → "IV", 5 → "V") println(romanNumeral(4)) // outputs: "IV" 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31. Back to Wicket Strong use of anonymous classes  Wicket programming model resembles Swing  Pushes developers to use anonymous, inner classes  Functional programming fits quite well into this model  Less code, less verbosity  Scala #win 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 32. Wicket + Scala: perfect combination Before, in Java /MyHomePage.java public class MyHomePage extends WebPage { @Inject private MyService service; public MyHomePage() { add(new Label(“msg”, “JavaOne”)); Form form = new Form(“form”, new CompoudPropertyModel(new User())){ public void onSubmit() { service.update(getModelObject()); } }; form.add(new TextField(“name”)); form.add(new TextField(“email”)); add(form); } } 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33. Wicket + Scala: perfect combination Now, with Scala /MyHomePage.scala class MyHomePage extends WebPage { @Inject var service: MyService = _ add(new Label(“msg”, “JavaOne”)) object form extends Form(“form”, new CompoundPropertyModel(new User())) { add(new TextField(“name”)) add(new TextField(“email”)) override def onSubmit() = { service.update(getModelObject()) } } add(form) } 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34. Wicket + Scala: perfect combination Now with specific Scala DSL for Wicket /MyHomePage.scala class MyHomePage extends WebPage with DSLWicket { @Inject var service: MyService = _ label(“msg”, “JavaOne”) val f = form(“form”, () ⇒ service.update(f.mobject)) f.scmodel(new User()) f.textField[String](“name”) f.textField[String](“email”) } 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 35. Java EE for everything else 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 36. Java EE 6 Filling the necessary gaps, extraordinarily well  Enterprise Java Beans  Contexts and Dependency Injection  Java Persistent API  Java Transaction API  Bean Validation  JAX-RS 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 37. And more stuff Like…  GlassFish Maven Embedded Plugin  Derby DB  No more web.xml – Servlet 3.0 is awesome  Getters/Setters generated – Scala’s @BeanProperty annotation 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 38. No more web.xml Servlet 3 and Scala package code.webapp import javax.servlet.annotation.{ WebFilter, WebInitParam } import org.apache.wicket.protocol.http.WicketFilter @WebFilter(value = Array("/*"), initParams = Array( new WebInitParam(name="applicationClassName", value="code.webapp.Application"), new WebInitParam(name="filterMappingUrlPattern", value = "/*“) )) class GamboaApplication extends WicketFilter 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 39. Getters/Setters generated Scala’s @BeanProperty annotation package code.data import scala.reflect.BeanProperty import javax.persistence.{ Id, GeneratedValue } trait Identifiable extends Serializable { @Id @GeneratedValue @BeanProperty var id: String = _ } 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 40. Getters/Setters generated Scala’s @BeanProperty annotation package code.data import scala.reflect.BeanProperty import javax.persistence.{ Entity, Table } @Entity @Table(name = “USERS”) class User extends Identifiable { @BeanProperty var name: String = _ @BeanProperty var email: String = _ } 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 41. Gamboa Project Great architecture, written an archetype must be! Apache Wicket + Java EE 6 + Scala Gamboa Project www.gamboa-project.org 41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 42. Gamboa Project Maven archetypes  Scala DSL for Wicket  3 archetypes – Java EE archetype  JPA, CDI, EJB3, GlassFish Maven Plugin integrated – Spring with CouchDB – Spring with MongoDB  Both integrated with Jetty plugin  Directory structure simplified for Web development – Not really “Maven convention”, for good reason 42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 43. Gamboa Project Directory Structure: simplified for Web development myproject $> tree |-- src --> .scala files | `-- code | |-- web | |-- services | `-- email |-- config --> configuration files | `-- email |-- layout --> .html files and presentation | |-- css | `-- js | `-- libs `-- pom.xml 43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 44. Gamboa Demo Group Birthday 44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 45. Next time you choose a web framework, think not only about features, but also about the web development process and the type of website you are going to build. 45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 46. QUESTIONS? 46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 47. THANK YOU! @brunoborges blogs.oracle.com/brunoborges 47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 48. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 49. 49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.