Wicket	
  and	
  Scala	
  

       +
                   Okpala Ikenna N. Jr.
                   bit.ly/ikennaokpala

     ...
+
An	
  Overview	
  	
  
What	
  is	
  

                 ?
• nvented by Martin Odersky.
 I
•  izza Into Java http://bit.ly/cudrM4
 P
•  hen GJ
 T
•  tarted 2001, First release 2003
...
Basic Scala Code on REPL:


object Ljc extends Application{ ---------------------- 1
println("Hello, London Java Community...
Basic Scala Code on REPL:
trait LjcTrait { ---------------- 4
def doSomething() {
println(“Which Group is this: “)}
def co...
“Apache Wicket” is component based
Java web framework, originally created
Jonathan Locke In 2004.
Why Wicket ?
- Wicket encourages total separation between plain Java code and HTML, with
the help of meaningful abstractio...
+
Scala Wicket maven archetype @ this address: http://jweekend.co.uk/dev/LegUp



    mvn archetype:generate -B -Darchetyp...
+
Basic Wicket and Scala Code:
class LegUp extends WebApplication {
  def getHomePage = classOf[HomePage]
}
class HomePage...
+
Basic Wicket and Scala Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, In...
+
Basic Wicket and Scala Code:

  <html>
  <body>
    <p><strong><a href="http://jweekend.com/dev/LegUp">LegUp</a>:
      ...
+
Basic Wicket and Scala Code:
+
IDE Support
  clipse and a lot more
 E
  nsime for scala on emacs
 E
 ntelliJ IDEA
 I
  etbeans
 N
  Rebel
 J
THANKS	
  
Upcoming SlideShare
Loading in...5
×

Short Lightening Talk

6,849

Published on

Short Lightening Talk

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
6,849
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Short Lightening Talk

  1. 1. Wicket  and  Scala   + Okpala Ikenna N. Jr. bit.ly/ikennaokpala July 27th, 2010 “Lightening Talk” on Wicket and Scala
  2. 2. + An  Overview    
  3. 3. What  is   ?
  4. 4. • nvented by Martin Odersky. I •  izza Into Java http://bit.ly/cudrM4 P •  hen GJ T •  tarted 2001, First release 2003 S •  cala Hybrid (Functional and OOP) S Programming Language •  tatically typed. S •  very value an object (var a = 2) E •  very operation a method call ( 1 + (2)) E •  ompiles to java byte code and runs on C the JVM • println (“Hello, World”) •  ariable with var or val… encouraging V immutability. •  ethod with def keyword M • Traits instead of interface •  attern matching (eg: exceptions) P •  igh Order Function H •  ML easier parsing X •  omain Specific Language(DSL) D
  5. 5. Basic Scala Code on REPL: object Ljc extends Application{ ---------------------- 1 println("Hello, London Java Community!”) } val group = “London Java Community” ------------- 2 def ljc (group: String ) :Unit = println(group) List(3.5, 2.5, 1.5) map(_* 2) -------------3
  6. 6. Basic Scala Code on REPL: trait LjcTrait { ---------------- 4 def doSomething() { println(“Which Group is this: “)} def computeSomething = “London Java Community” .length * 10 } class Ljc extends LjcTrait {-----------5 override def toString = “London Java Community” override def dosomething (){ println(“Which Group is this: “+toString+”!”) }
  7. 7. “Apache Wicket” is component based Java web framework, originally created Jonathan Locke In 2004.
  8. 8. Why Wicket ? - Wicket encourages total separation between plain Java code and HTML, with the help of meaningful abstractions. (i.e. allows the java code to handle all the logic) - Wicket provides excellent support and management of server side state transparently. - Very little XML configuration is required to get your web application going. this is not the case when compared to some other frameworks that are largely dependent on XML config kind of files. - And finally, it does not have any special mark up that you would have to learn afresh (i.e. just HTML tags are marked with a simple and very unnoticeable “wicket:id” tag, and you are done).
  9. 9. + Scala Wicket maven archetype @ this address: http://jweekend.co.uk/dev/LegUp mvn archetype:generate -B -DarchetypeCatalog=http:// legup.googlecode.com/svn/repo/archetype-catalog.xml - DarchetypeArtifactId=LegUpScalaWicketQuickStart- archetype - DarchetypeGroupId=com.jweekend.learnscala - DarchetypeVersion=0.8.3 -DgroupId=com.mycompany - DartifactId=mycompany -Dversion=1.0-SNAPSHOT - Dpackage=com.mycompany
  10. 10. + Basic Wicket and Scala Code: class LegUp extends WebApplication { def getHomePage = classOf[HomePage] } class HomePage extends WebPage { var name = "Hello!" val form = new Form[String]("form") add(form) form.add(new TextField[String]("nameField", new ToySafeModel[String](name, {null; name = _}))) form.add(new Label("nameLabel", new ToySafeModel[String](name , null))) } class ToySafeModel[T](accessor: => T, mutator: T => Unit) extends IModel[T]() { override def getObject() = accessor override def setObject(t: T) = mutator(t) override def detach() = Nil }
  11. 11. + Basic Wicket and Scala Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" http://java.sun.com/dtd/web-app_2_3.dtd> <web-app> <display-name>Hello, Wicket World!</display-name> <filter><filter-name>HelloWicketWorld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param><param-name>applicationClassName</param-name> <param-value>com.mycompany.LegUp</param-value> </init-param> </filter> <filter-mapping><filter-name>HelloWicketWorld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
  12. 12. + Basic Wicket and Scala Code: <html> <body> <p><strong><a href="http://jweekend.com/dev/LegUp">LegUp</a>: <a href="http://wicket.apache.org">Wicket</a> on <a href="http:// scala-lang.org">Scala</a></strong></p> <form wicket:id="form"> <label for="nameField">How do you greet people?</label> <input wicket:id="nameField" id="nameField" /> <input type="submit" value="Submit"/> <p wicket:id="nameLabel"></p> </form> </body> </html>
  13. 13. + Basic Wicket and Scala Code:
  14. 14. + IDE Support   clipse and a lot more E   nsime for scala on emacs E  ntelliJ IDEA I   etbeans N   Rebel J
  15. 15. THANKS  
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×