Your SlideShare is downloading. ×
Short Lightening Talk
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Short Lightening Talk


Published on

Short Lightening Talk

Short Lightening Talk

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Wicket  and  Scala   + Okpala Ikenna N. Jr. July 27th, 2010 “Lightening Talk” on Wicket and Scala
  • 2. + An  Overview    
  • 3. What  is   ?
  • 4. • nvented by Martin Odersky. I •  izza Into Java 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. 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. 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. “Apache Wicket” is component based Java web framework, originally created Jonathan Locke In 2004.
  • 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. + Scala Wicket maven archetype @ this address: mvn archetype:generate -B -DarchetypeCatalog=http:// - DarchetypeArtifactId=LegUpScalaWicketQuickStart- archetype - DarchetypeGroupId=com.jweekend.learnscala - DarchetypeVersion=0.8.3 -DgroupId=com.mycompany - DartifactId=mycompany -Dversion=1.0-SNAPSHOT - Dpackage=com.mycompany
  • 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. + 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"> <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. + Basic Wicket and Scala Code: <html> <body> <p><strong><a href="">LegUp</a>: <a href="">Wicket</a> on <a href="http://">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. + Basic Wicket and Scala Code:
  • 14. + IDE Support   clipse and a lot more E   nsime for scala on emacs E  ntelliJ IDEA I   etbeans N   Rebel J
  • 15. THANKS