215
An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist Mystic Coders, LLC andrew AT mysticcoders DOT com kinabalu @ irc://irc.freenode.net - ##wicket, ##java kinabalu @ twitter Tuesday, October 18, 11

An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

An in depth look atApache Wicket

Andrew LombardiOwner, Tech EvangelistMystic Coders, LLCandrew AT mysticcoders DOT com

kinabalu @ irc://irc.freenode.net - ##wicket, ##javakinabalu @ twitter

Tuesday, October 18, 11

Page 2: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 3: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

10 Years in business

Tuesday, October 18, 11

Page 4: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Software Consultants

10 Years in business

Tuesday, October 18, 11

Page 5: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Software Consultants

International Speaker

10 Years in business

Tuesday, October 18, 11

Page 6: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Software Consultants

International Speaker

Training

10 Years in business

Tuesday, October 18, 11

Page 7: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Software Consultants

International Speaker

Training

10 Years in business

Apache Wicket Contributor

Tuesday, October 18, 11

Page 8: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

To our success!

Software Consultants

International Speaker

Training

10 Years in business

Apache Wicket Contributor

Tuesday, October 18, 11

Page 9: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 10: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

What is a Wicket?

Tuesday, October 18, 11

Page 11: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 12: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 13: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 14: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 15: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket is a component-based web framework using Java and HTML.

Wicket is...

Tuesday, October 18, 11

Page 16: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

What we’ll cover

Tuesday, October 18, 11

Page 17: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

1. How to get started

What we’ll cover

Tuesday, October 18, 11

Page 18: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

1. How to get started2. Building your first app

What we’ll cover

Tuesday, October 18, 11

Page 19: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

1. How to get started2. Building your first app3. Further Resources

What we’ll cover

Tuesday, October 18, 11

Page 20: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

The Cooking show model

Tuesday, October 18, 11

Page 21: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Why Wicket ?

Tuesday, October 18, 11

Page 22: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Version 1.0 in June 2005

Tuesday, October 18, 11

Page 23: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

+

Top Level Project June 2007

Tuesday, October 18, 11

Page 24: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

(optional)

Tuesday, October 18, 11

Page 25: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

That’s it.

(optional)

Tuesday, October 18, 11

Page 26: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

And many more...Tuesday, October 18, 11

Page 27: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Who uses it?

Tuesday, October 18, 11

Page 28: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Who uses it?

Tuesday, October 18, 11

Page 29: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

http://cwe.mitre.org/top25/

Security Best Practices

"Cross-site scripting is the practice of embedding malicious scriptinto a Web page that can execute when users visit the page. To wardoff such attacks, the report recommends using frameworks and librariesto control output, including "[...] Apache Wicket." Programmers should usestrong character encoding and set the browser cookie session toHttpOnly."

Tuesday, October 18, 11

Page 30: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Community

• Part of the Apache Software Foundation• VERY active mailing list• ##wicket on irc.freenode.net

Tuesday, October 18, 11

Page 31: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket Components

Tuesday, October 18, 11

Page 32: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket Components

Tuesday, October 18, 11

Page 33: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket Components

+

Tuesday, October 18, 11

Page 34: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket Components

+

Tuesday, October 18, 11

Page 35: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket is just Java

Tuesday, October 18, 11

Page 36: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Components are objects (use extends)

Wicket is just Java

Tuesday, October 18, 11

Page 37: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Components are objects (use extends)• Sparse use of annotations

Wicket is just Java

Tuesday, October 18, 11

Page 38: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Components are objects (use extends)• Sparse use of annotations• Not framework managed (use new)

Wicket is just Java

Tuesday, October 18, 11

Page 39: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket is just HTML

Tuesday, October 18, 11

Page 40: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Designer friendly

Wicket is just HTML

Tuesday, October 18, 11

Page 41: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Designer friendly• No scriptlets in HTML

Wicket is just HTML

Tuesday, October 18, 11

Page 42: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Designer friendly• No scriptlets in HTML• Developers won’t ruin pixel perfection

Wicket is just HTML

Tuesday, October 18, 11

Page 43: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Designer friendly• No scriptlets in HTML• Developers won’t ruin pixel perfection• Designers won’t screw up your tags

Wicket is just HTML

Tuesday, October 18, 11

Page 44: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 45: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 46: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 47: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 48: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 49: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

No XML

Tuesday, October 18, 11

Page 50: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 51: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

wicket-quickstart or the Wicket maven archetype headstart

Tuesday, October 18, 11

Page 52: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

mvn archetype:create -DarchetypeGroupId=org.apache.wicket

-DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4.1 -DgroupId=com.mycompany -DartifactId=myproject

or

wicket-quickstart module

http://wicket.apache.org/quickstart.html

Tuesday, October 18, 11

Page 53: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 54: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 55: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Quickstart

DEMOTuesday, October 18, 11

Page 56: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 57: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Hello, World!

Tuesday, October 18, 11

Page 58: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

<h1>Hello, World!</h1>

Hello, World!

Tuesday, October 18, 11

Page 59: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

<h1 wicket:id=”message”>[label text]</h1>

Hello, World!

Tuesday, October 18, 11

Page 60: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

<h1 wicket:id=”message”>[label text]</h1>

add(new Label(“message”, “Hello, World!”));

+

Hello, World!

Tuesday, October 18, 11

Page 61: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

+

=

<h1>Hello, World!</h1>

<h1 wicket:id=”message”>[label text]</h1>

add(new Label(“message”, “Hello, World!”));

Hello, World!

Tuesday, October 18, 11

Page 62: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

<html xmlns:wicket=”http://wicket.apache.org”> <head> <title>Home Page</title> </head> <body> <h1 wicket:id=”message”>[label text]</h1> </body></html>

Hello, World!

Tuesday, October 18, 11

Page 63: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

import org.apache.wicket.markup.html.WebPage;import org.apache.wicket.markup.html.basic.Label;

public class HomePage extends WebPage {public HomePage() {

add(new Label(“message”, “Hello, World!”);}

}

Hello, World!

Tuesday, October 18, 11

Page 64: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Application class

Tuesday, October 18, 11

Page 65: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages

Application class

Tuesday, October 18, 11

Page 66: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration

Application class

Tuesday, October 18, 11

Page 67: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation

Application class

Tuesday, October 18, 11

Page 68: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation•Authentication strategies

Application class

Tuesday, October 18, 11

Page 69: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation•Authentication strategies•Custom URL mounts

Application class

Tuesday, October 18, 11

Page 70: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation•Authentication strategies•Custom URL mounts•Resource mounting

Application class

Tuesday, October 18, 11

Page 71: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation•Authentication strategies•Custom URL mounts•Resource mounting•Refactorable

Application class

Tuesday, October 18, 11

Page 72: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Mount bookmarkable pages•Spring/Guice Integration•Custom WebSession implementation•Authentication strategies•Custom URL mounts•Resource mounting•Refactorable•Debuggable

Application class

Tuesday, October 18, 11

Page 73: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Page layout in Wicket allows you to inherit and use composition for markup

Tuesday, October 18, 11

Page 74: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

* Username

Login

* Password

Login

Tuesday, October 18, 11

Page 75: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

* Username

Login

* Password

Login

Tuesday, October 18, 11

Page 76: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

* Username

Login

* Password

Login

Tuesday, October 18, 11

Page 77: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Markup inheritance

DEMOTuesday, October 18, 11

Page 78: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 79: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Markup Inheritance

Tuesday, October 18, 11

Page 80: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Easy templating

Markup Inheritance

Tuesday, October 18, 11

Page 81: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Easy templating• Smart header contribution

Markup Inheritance

Tuesday, October 18, 11

Page 82: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Easy templating• Smart header contribution• Mix and match components and panel

Markup Inheritance

Tuesday, October 18, 11

Page 83: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Easy templating• Smart header contribution• Mix and match components and panel• Usable with Panel’s as well

Markup Inheritance

Tuesday, October 18, 11

Page 84: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Forms in Wicket allow you to accept, process and validate user input.

Tuesday, October 18, 11

Page 85: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Button

TextField, TextArea

CheckBox, CheckGroup, Check

Form Components

DropDownChoice

ListChoice

RadioGroup

RadioChoice

Tuesday, October 18, 11

Page 86: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Start onSubmit

onError

required check

pushinput

validate input

convertinput

fail fail fail

Form Processing Flow

Tuesday, October 18, 11

Page 87: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Form

DEMOTuesday, October 18, 11

Page 88: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 89: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

“Computer Science is a science of abstraction - creating the right model for a problem and devising the appropriate mechanizable techniques to solve it.”

-A Aho & J. Ullman

Tuesday, October 18, 11

Page 90: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

A Model in Wicket allows components to retrieve and store data.

Tuesday, October 18, 11

Page 91: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

idComponent

getObject():TsetObject(T)

<<interface>>IModel<T>

Label TextField<T> Page

Tuesday, October 18, 11

Page 92: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Flow of Model DataMystic Paste

Paste

Controller

View

TextArea

Locator

IModel

Model

PasteItemcontent

Receives

Sets

Sets

Gets

Gets

Renders

Tuesday, October 18, 11

Page 93: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Not using models?

new Label("street", ! ! customer.getAddress().getStreet());

•Label doesn’t get notified if address / street / customer changes•Possible NullPointerException if customer or address is null

Tuesday, October 18, 11

Page 94: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

PropertyModel saves the day

new Label("street", ! ! new PropertyModel(customer, “address.street”));

Tuesday, October 18, 11

Page 95: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

PropertyModel saves the day

new Label("street", ! ! new PropertyModel(customer, “address.street”));

•Safe from NullPointerException’s•Dynamic

Tuesday, October 18, 11

Page 96: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

PropertyModel

DEMOTuesday, October 18, 11

Page 97: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 98: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Model Description

Model Simple model used to store static content, or used as a base class for dynamic behavior.

PropertyModel Uses a property expression to dynamically access a property of your domain objects.

CompoundPropertyModel Uses component identifiers as property expressions to bind components to its domain objects.

LoadableDetachableModel Abstract model for quickly creating detachable models.

ResourceModel Easy-to-use model for retrieving messages from resource bundles.

StringResourceModel Advanced model for retrieving messages from resource bundles; supports property expressions and MessageFormat substitutions.

Wicket Core Models

Tuesday, October 18, 11

Page 99: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Session usage in Wicket is managed by detaching unnecessary objects.

Tuesday, October 18, 11

Page 100: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

detach()

<<Interface>>IDetachable

value : SerializableModel<T>

getObject():TsetObject(T)

<<Interface>>IModel

Tuesday, October 18, 11

Page 101: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

LoadableDetachableModelnew ViewPaste(new Model(pasteItem)) new ViewPaste(new DetachablePasteModel

(pasteItem))

Session

PasteItem ObjectLarge

ViewPaste

Session

IdentifierSmall

ViewPaste

Tuesday, October 18, 11

Page 102: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

private class DetachedPasteModel extends LoadableDetachableModel<PasteItem> {

!! String id;!! public DetachedPasteModel(String id) {! ! this.id = id;! }!! protected PasteItem load() {! ! try {! ! ! return pasteService.getItem("web", Long.parseLong(id));! ! } catch (InvalidClientException e) {! ! ! e.printStackTrace();! ! }! ! return null;! }}

Tuesday, October 18, 11

Page 103: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Nested Modelspublic class DefaultWhenNullModel<T> implements IModel<T> {! private static final long serialVersionUID = 1L;

! private final IModel<T> nestedModel; ! private final T defaultValue;

! public DefaultWhenNullModel(IModel<T> nestedModel, T defaultValue) { ! ! this.nestedModel = nestedModel; ! ! this.defaultValue = defaultValue; ! }

! public T getObject() { ! ! T val = nestedModel.getObject(); ! ! return val == null ? defaultValue : val; ! }

! public void setObject(T object) { ! ! nestedModel.setObject(object); ! }

! public void detach() { ! ! nestedModel.detach(); ! } }

Tuesday, October 18, 11

Page 104: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Nested Models

Form form = new Form( new CompoundPropertyModel<Profile>( new ProfileDetachableModel()));

form.add(new TextField("firstName"));

Tuesday, October 18, 11

Page 105: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

StringResourceModel

Profile profile = new Profile();profile.setFirstName("Werner");profile.setLastName("Brandis");

add(new Label("verifyMessage",! ! new StringResourceModel("verify.message", this, new Model(profile)));

MyPage.java

MyPage.properties

verify.message=Hi. My name is ${firstName} ${lastName}. My voice is my passport. Verify me.

Tuesday, October 18, 11

Page 106: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Form Validation in Wicket is attached to components or the form.

Tuesday, October 18, 11

Page 107: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

NumberValidator - Validate’s max, min, range for a Number

StringValidator - Validate’s max, min, length for a String

PatternValidator - Validate’s the String input matches theregex pattern

Wicket Validators

EmailAddressValidator - Validate’s field contains a valid email

EqualPasswordInputValidator - Form validation of twopassword fields being equal

Tuesday, October 18, 11

Page 108: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Form Validation

DEMOTuesday, October 18, 11

Page 109: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 110: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

FeedbackMessages

Tuesday, October 18, 11

Page 111: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Page class

FeedbackMessages

Tuesday, October 18, 11

Page 112: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Page class• Component class

FeedbackMessages

Tuesday, October 18, 11

Page 113: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Page class• Component class• Application class

FeedbackMessages

Tuesday, October 18, 11

Page 114: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Page class• Component class• Application class• Application base class

FeedbackMessages

Tuesday, October 18, 11

Page 115: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

ComponentFeedbackMessageFilter - Gives only messages for a specific component

ContainerFeedbackMessageFilter - Gives only messages for a specific container component and its children

ErrorLevelFeedbackMessageFilter - Gives only messages at a certain level (or higher)

FeedbackPanel

Tuesday, October 18, 11

Page 116: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Repeaters in Wicket allow you to show blocks of markup multiple times.

Tuesday, October 18, 11

Page 117: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Repeaters

Tuesday, October 18, 11

Page 118: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView

Repeaters

Tuesday, October 18, 11

Page 119: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView• RefreshingView

Repeaters

Tuesday, October 18, 11

Page 120: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView• RefreshingView• ListView

Repeaters

Tuesday, October 18, 11

Page 121: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView• RefreshingView• ListView• DataView

Repeaters

Tuesday, October 18, 11

Page 122: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView• RefreshingView• ListView• DataView• GridView

Repeaters

Tuesday, October 18, 11

Page 123: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• RepeatingView• RefreshingView• ListView• DataView• GridView• DataTable

Repeaters

Tuesday, October 18, 11

Page 124: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

DataTable is an example of an easily reusable and customizable component

Tuesday, October 18, 11

Page 125: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 126: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Pageable

Tuesday, October 18, 11

Page 127: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Pageable

Sortable

Tuesday, October 18, 11

Page 128: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Pageable

Sortable

Searchable

Tuesday, October 18, 11

Page 129: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Pageable

Sortable

Searchable

Easy to Style

Tuesday, October 18, 11

Page 130: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Pageable

Sortable

Searchable

Easy to Style

Filterable

Tuesday, October 18, 11

Page 131: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

ListView

DEMOTuesday, October 18, 11

Page 132: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 133: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Behaviors in Wicket are decorators for components.

Tuesday, October 18, 11

Page 134: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Behavior

DEMOTuesday, October 18, 11

Page 135: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 136: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Behaviors

Tuesday, October 18, 11

Page 137: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Can manipulate component tags

Behaviors

Tuesday, October 18, 11

Page 138: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Can manipulate component tags• Add custom Javascript to components

Behaviors

Tuesday, October 18, 11

Page 139: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

• Can manipulate component tags• Add custom Javascript to components• Add AJAX behavior to components

Behaviors

Tuesday, October 18, 11

Page 140: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Adding Javascript to a component

DEMOTuesday, October 18, 11

Page 141: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 142: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Using WicketTester and FormTester to unit test our Wicket application.

Tuesday, October 18, 11

Page 143: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

WicketTester

Tuesday, October 18, 11

Page 144: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Test Pages and components outside of container

WicketTester

Tuesday, October 18, 11

Page 145: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Test Pages and components outside of container•Test Forms

WicketTester

Tuesday, October 18, 11

Page 146: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Test Pages and components outside of container•Test Forms•Test AJAX interactions

WicketTester

Tuesday, October 18, 11

Page 147: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

•Test Pages and components outside of container•Test Forms•Test AJAX interactions•Can run against any build tool that supports JUnit or TestNG

WicketTester

Tuesday, October 18, 11

Page 148: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Simple page test

DEMOTuesday, October 18, 11

Page 149: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 150: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Click counter test

DEMOTuesday, October 18, 11

Page 151: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 152: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Search Form test

DEMOTuesday, October 18, 11

Page 153: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 154: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Search Form testw/ error

DEMOTuesday, October 18, 11

Page 155: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 156: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

“Our team has been able to cut the LOC count by a factor of about 10 (!) moving from a JSP Based Framework to Wicket...”

-Leo Erlandsson

Tuesday, October 18, 11

Page 157: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Quick framework comparison

Tuesday, October 18, 11

Page 158: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT

Tuesday, October 18, 11

Page 159: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

Tuesday, October 18, 11

Page 160: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript

Tuesday, October 18, 11

Page 161: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server

Tuesday, October 18, 11

Page 162: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server

Tuesday, October 18, 11

Page 163: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library

Tuesday, October 18, 11

Page 164: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

Tuesday, October 18, 11

Page 165: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con

Tuesday, October 18, 11

Page 166: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly

Tuesday, October 18, 11

Page 167: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test

Tuesday, October 18, 11

Page 168: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test• Data security problems (client-side state)

Tuesday, October 18, 11

Page 169: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test• Data security problems (client-side state)• GWT compiler is slow

Tuesday, October 18, 11

Page 170: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test• Data security problems (client-side state)• GWT compiler is slow• Front-end design in Java

Tuesday, October 18, 11

Page 171: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test• Data security problems (client-side state)• GWT compiler is slow• Front-end design in Java• Maven support is flaky

Tuesday, October 18, 11

Page 172: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

GWT• Pro

• Use Java for client-side Javascript• Can send complex Java objects to client from server• Scalable since state is on server• Rich widget library• Simple for AJAX

• Con• SEO unfriendly• Difficult to test• Data security problems (client-side state)• GWT compiler is slow• Front-end design in Java• Maven support is flaky• Not easily bookmarkable

Tuesday, October 18, 11

Page 173: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF

Tuesday, October 18, 11

Page 174: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

Tuesday, October 18, 11

Page 175: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support

Tuesday, October 18, 11

Page 176: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard

Tuesday, October 18, 11

Page 177: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling

Tuesday, October 18, 11

Page 178: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

Tuesday, October 18, 11

Page 179: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con

Tuesday, October 18, 11

Page 180: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con• Sun standard

Tuesday, October 18, 11

Page 181: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con• Sun standard• JSP tag soup

Tuesday, October 18, 11

Page 182: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con• Sun standard• JSP tag soup• Library jarhell

Tuesday, October 18, 11

Page 183: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con• Sun standard• JSP tag soup• Library jarhell• Painful without Facelets

Tuesday, October 18, 11

Page 184: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

JSF• Pro

• Commercial support• Sun standard• Advanced tooling• Rich widget / component library

• Con• Sun standard• JSP tag soup• Library jarhell• Painful without Facelets• Multiple implementations to choose from

Tuesday, October 18, 11

Page 185: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket

Tuesday, October 18, 11

Page 186: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

Tuesday, October 18, 11

Page 187: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code

Tuesday, October 18, 11

Page 188: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)

Tuesday, October 18, 11

Page 189: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components

Tuesday, October 18, 11

Page 190: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library

Tuesday, October 18, 11

Page 191: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML

Tuesday, October 18, 11

Page 192: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug

Tuesday, October 18, 11

Page 193: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

Tuesday, October 18, 11

Page 194: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con

Tuesday, October 18, 11

Page 195: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con• Documentation and examples

Tuesday, October 18, 11

Page 196: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con• Documentation and examples• More initial Java code

Tuesday, October 18, 11

Page 197: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con• Documentation and examples• More initial Java code • AJAX support requires server round-trip

Tuesday, October 18, 11

Page 198: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con• Documentation and examples• More initial Java code • AJAX support requires server round-trip• Wicket internals difficult to grok

Tuesday, October 18, 11

Page 199: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket• Pro

• True separation of layout and code• Component based (true reusability)• Simple AJAX support with existing components• Rich community support mailing list and widget library• Just Java and Just HTML• Easy to refactor and debug• Object oriented by design

• Con• Documentation and examples• More initial Java code • AJAX support requires server round-trip• Wicket internals difficult to grok• Object oriented by design

Tuesday, October 18, 11

Page 200: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 201: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket: HTML and Java

Tuesday, October 18, 11

Page 202: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket: HTML and Java

Typical MVC: JSP, HTML, taglibs, Java, and XML

Tuesday, October 18, 11

Page 203: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

More websites for Wicket knowledge

RESOURCES

Tuesday, October 18, 11

Page 204: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

By Andrew Lombardi

ABOUT APACHE WICKET

ww

w.d

zone

.co

m

G

et M

ore

Ref

card

z! V

isit

ref

card

z.co

m

#61

Getting Started with Apache Wicket

Apache Wicket is a Java-based web application framework that has rapidly grown to be a favorite among many developers. It features a POJO data model, no XML, and a proper mark-up / logic separation not seen in most frameworks. Apache Wicket gives you a simple framework for creating powerful, reusable components and offers an object oriented methodology to web development while requiring only Java and HTML.

Hot Tip

Depending on your configuration needs, you can set this parameter in the web.xml as either: a context-param or init-param to the filter a command line parameter wicket.configuration by overriding Application.getConfigurationType()

PROJECT LAYOUT

The project layout most typical of Apache Wicket applications is based on the default Maven directories. Any Wicket component that requires view markup in the form of HTML needs to be side-by-side with the Java file. Using Maven however, we can separate the source directories into java/ and resources/ to give some distinction. To get started, download either the wicket-quickstart project and modify it to your needs, or use the maven archetype here:

mvn archetype:create \-DarchetypeGroupId=org.apache.wicket \-DarchetypeArtifactId=wicket-archetype-quickstart \-DarchetypeVersion=1.3.5 \

��������������������������������������� <param-value>/refcard</param-value> </init-param> ���������������������������� � ������������������������������������������� <url-pattern>/*</url-pattern> ����������������� � </web-app>

Apache Wicket offers a development and deplyoment mode that can be configured in the web.xml file:

<context-param> ����������������� ���������������� <param-value>development</param-value> </context-param>

MODELS

Apache Wicket uses models to separate the domain layer from the view layer in your application and to bind them together. Tuesday, October 18, 11

Page 205: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

http://www.mysticcoders.com/blog/2009/03/09/5-days-of-wicket/

Tuesday, October 18, 11

Page 206: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 207: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 210: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

http://wicketbyexample.com

•Customized Clustering options

Latest examples:

Tuesday, October 18, 11

Page 211: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

http://wicketbyexample.com

•Customized Clustering options•Integrating HTML5 and Wicket

Latest examples:

Tuesday, October 18, 11

Page 212: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

http://wicketbyexample.com

•Customized Clustering options•Integrating HTML5 and Wicket•Ajax-based Confirmation Modal window

Latest examples:

Tuesday, October 18, 11

Page 213: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Tuesday, October 18, 11

Page 214: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Wicket Rocks!!

Tuesday, October 18, 11

Page 215: An in depth look at Apache Wicket - Amazon Web …mysticweb-bucket.s3.amazonaws.com/presentations/october...An in depth look at Apache Wicket Andrew Lombardi Owner, Tech Evangelist

Q&AThanks for listening!

Andrew LombardiOwner, Tech EvangelistMystic Coders, LLCandrew AT mysticcoders DOT com

kinabalu @ irc://irc.freenode.net - ##wicket, ##java

Tuesday, October 18, 11