Apache Wicket
Web applications with just Java
Martijn Dashorst

•   Committer

•   Chair

•   Author
Martijn Dashorst

•   Committer

•   Chair

•   Author
Agenda

• What is Wicket?
• Wicket concepts
• Wicket roadmap
Wicket?
Wicket?
Wicket

• Component oriented
• Open source
• Web application framework
• Java+HTML
Hello, World!
Hello, World!
Hello, World!
<h1 wicket:id=”msg”>[text goes here]</h1>
Hello, World!
<h1 wicket:id=”msg”>[text goes here]</h1>
                    +
  add(new Label(“msg”, “Hello, World!”));
Hello, World!
<h1 wicket:id=”msg”>[text goes here]</h1>
                    +
  add(new Label(“msg”, “Hello, World!”));
  ...
A brief history of Wicket
• Discovery of the Hobbit
  • Year of the monkey
  • Milau bridge opens




                                              ...
2005
• Dr. Who returns
• A380’s maiden flight
• Huygens lands on Titan
2005
• Dr. Who returns
• A380’s maiden flight
• Huygens lands on Titan
First Wicket meetup
First Wicket meetup
First Wicket meetup
JavaOne’05
JavaOne’05
     Tapestry
       guy         Bald     Struts/Shale
                   guy          guy




                ...
JavaOne’05



Wicket 1.0
Wicket uptake
Wicket uptake
Wicket 1.0
 released
Wicket uptake
                Wicket 1.2
                 released
Wicket 1.0
 released
Wicket uptake
                      Wicket 1.2
                       released
Wicket 1.0
 released




             Joine...
Wicket uptake

Dice (US)       15

Indeed (US)     85
 Monster        29
 (world)
Popular?

Java Software


Apache Software Foundation


Web frameworks
Projects
•   core

•   extensions
                                         Wicket
                                        ...
Getting Wicket

• Everybody gets the
  ultimate edition
• Includes sources
• Currently 1.3-rc1
• Or...
Use maven

<dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket</artifactId>
  <version>1.3.0-rc1</ver...
Agenda

• What is Wicket?
• Wicket concepts
• Wicket roadmap
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
Application

• Main entry point for your web application
• Initialization
• Configuration
• Homepage
• Factories
Application
•   Configured in web.xml:
    <filter>
      <filter-name>wicket</servlet-name>
      <filter-class>
          or...
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
Session


• Abstraction of a user session
• Stores session specific data
Session
class MySession extends WebSession {
   private ShoppingCart cart;
   public ShoppingCart getCart() { … }
   publi...
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
RequestCycle

• Encapsulates one request
• Cleans up resources at end
• Can be used as OpenSessionInViewFilter
RequestCycle
1. Create request cycle object
2. Decode the request
3. Identify request target (page, component, …)
4. Proce...
RequestCycle

• Two types of requests:
 • Stateful
 • Stateless
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
Component

• encapsulate the programmatic manipulation
  of markup
• can receive an event (onClick, onSubmit)
• know how a...
Component
 • Ultimate super class wicket.Component
         Label                ListView
    MultiLineLabel              ...
Component + Markup
• Component has wicket:id
• Markup has same wicket:id
• Hierarchy must match
 <h1 wicket:id=“msg”>Gets ...
Component: Link
<a href=”#” wicket:id=”link”>Click</a>

Link link = new Link(“link”) {
   @Override public void onClick() ...
Component: AjaxLink
<a href=”#” wicket:id=”link”>Click</a>

someComponent.setOutputMarkupId(true);
AjaxLink link = new Aja...
Component + Markup

• Some components
  have own markup file
• Put Java, markup and
  supporting files in
  same package on ...
A page: Hello, World!
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
Behaviors


• Plugins for components
• Modify markup
Behavior
link.add(new AbstractBehavior() {
    public void onComponentTag(
      Component component, ComponentTag tag) {
...
Behaviors
  • Change attributes of your component’s
     markup
  • Add javascript events
  • Add Ajax behavior
component....
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
Models
• Models bind your POJO’s to Wicket
  components

                   PropertyModel
       Label
                   ...
Java lazy binding sucks

• Doesn’t update:
  new Label(“name”, person.getName())
• Null checks necessary:
  new Label(“str...
Models
• PropertyModel:
  new PropertyModel(p, “name)
  new PropertyModel(p, “address.street”)
• CompoundPropertyModel:
  ...
Agenda

• What is Wicket?
• Wicket concepts
• Wicket roadmap
Roadmap
    4/22/07    4/22-4/30       couple of weeks         somewhere in june



wicket 1.2.6                         w...
Roadmap

• Release 1.3.0 (december)
• Wicket 1.4/2.0
 • Java 5!!!!
 • first milestone release after 1.3.1-ish
Conclusions

• Easy creation and use of custom
  components
• Up and coming framework
• Popular
• Great community
Questions?
Apache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just Java
Upcoming SlideShare
Loading in...5
×

Apache Wicket: Web Applications With Just Java

14,840

Published on

A short (30 minute) introduction to the Apache Wicket web application framework showing its history, uptake and core concepts.

Published in: Technology, Education
2 Comments
16 Likes
Statistics
Notes
  • Venkatesh Reddy : - Senior Software Developer in Saggezza India Pvt Ltd. The PPt is very nice and use full to beginners, can you send this ppt or any more on wicket, to my official mail where i can reach venkatesh.reddy@saggezza.com.
    Thank you
    Regards:
    Venkatesh Reddy
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • good one ,,,,, can the author mail me this ppt at kcchat@gmail.com .... :) .... Thanks n Regards..
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
14,840
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
0
Comments
2
Likes
16
Embeds 0
No embeds

No notes for slide

Apache Wicket: Web Applications With Just Java

  1. 1. Apache Wicket Web applications with just Java
  2. 2. Martijn Dashorst • Committer • Chair • Author
  3. 3. Martijn Dashorst • Committer • Chair • Author
  4. 4. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  5. 5. Wicket?
  6. 6. Wicket?
  7. 7. Wicket • Component oriented • Open source • Web application framework • Java+HTML
  8. 8. Hello, World!
  9. 9. Hello, World!
  10. 10. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1>
  11. 11. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1> + add(new Label(“msg”, “Hello, World!”));
  12. 12. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1> + add(new Label(“msg”, “Hello, World!”)); = <h1>Hello, World!</h1>
  13. 13. A brief history of Wicket
  14. 14. • Discovery of the Hobbit • Year of the monkey • Milau bridge opens 2004 photo by: 5lab (http://flickr.com/photos/5lab/382292934/)
  15. 15. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  16. 16. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  17. 17. First Wicket meetup
  18. 18. First Wicket meetup
  19. 19. First Wicket meetup
  20. 20. JavaOne’05
  21. 21. JavaOne’05 Tapestry guy Bald Struts/Shale guy guy Wicket JSF guy WebWork guy guy
  22. 22. JavaOne’05 Wicket 1.0
  23. 23. Wicket uptake
  24. 24. Wicket uptake Wicket 1.0 released
  25. 25. Wicket uptake Wicket 1.2 released Wicket 1.0 released
  26. 26. Wicket uptake Wicket 1.2 released Wicket 1.0 released Joined Apache
  27. 27. Wicket uptake Dice (US) 15 Indeed (US) 85 Monster 29 (world)
  28. 28. Popular? Java Software Apache Software Foundation Web frameworks
  29. 29. Projects • core • extensions Wicket Welcome to Apache Wick et Home With proper Introduction mark-up/logic separation, a makes devel Planet Wick POJO data mo oping web-ap et del, and a ref ps simple an brittle code reshing lack d enjoyable for powerful, Community again. Swap of XML, Apach reusable comp the boilerplate e Wicket onents writte , complex de n with plain Check the fea bugging and News Java and HTML ture list . Read some Wi cket buzz, so Getting Star me Wicket blo Find out why • ted gs or Planet you should us Wicket e Wicket Check out so me selected examples in Examples Take a look ioc (spring, guice) detail or see at our live co them and ma mponent ref Getting Wick Go and down ny more in live erence et load Wicket. action Components Wicket is rel eased under QuickStart the Apache Lic ense, Version 2.0. Commun ity meetings Documentatio n The Wicket co mmunity is a Wiki very active co But for those mmunity. Th that prefer fac e mailing list e to face me Blogs s and the irc etings, severa • channel are l community proof of that. Reference members ha ve organized Where meetups. London, The Vision date/time United Kingd om When JavaDocs Amsterdam, The first Tuesd The Netherla nds ay of every mo Antwerp, Belgi nth Nov. 30th, 20 um Releases 07 Copenhagen JavaPolis'07 , Denmark (dec 12th-14 Wicket 1.3-r th) Linz/Hagenbe c to be determi rg, Austria ned Wicket 1.2 Stockholm, Sw to be determi eden ned Wicket 1.1 Rio de Janeir Januari o, Brazil Wicket 1.0 Minneapolis/ to be determi Seattle, USA • ned Tool suppor to be determi If you are int ned t velocity erested in att ending one of you want to these events organize such IDE plugins , please add a meetup yo yourself to the urself, add it appropriate to the comm News event, or if unity meetups Developers page Apache Wick Reporting bu et 1.3.0-rc1 gs is released! Writing docs Nov 11, 2007 Building This release is the first in • a series of rel ease candidate s until we fee l confident to auth-roles finalize Wicke t 1.3. This
  30. 30. Getting Wicket • Everybody gets the ultimate edition • Includes sources • Currently 1.3-rc1 • Or...
  31. 31. Use maven <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket</artifactId> <version>1.3.0-rc1</version> </dependency>
  32. 32. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  33. 33. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  34. 34. Application • Main entry point for your web application • Initialization • Configuration • Homepage • Factories
  35. 35. Application • Configured in web.xml: <filter> <filter-name>wicket</servlet-name> <filter-class> org.apache.wicket.protocol.http.WicketFilter </filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>example.MyApplication</param-value> </init-param> </filter>
  36. 36. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  37. 37. Session • Abstraction of a user session • Stores session specific data
  38. 38. Session class MySession extends WebSession { private ShoppingCart cart; public ShoppingCart getCart() { … } public void setCart(ShoppingCart cart) { … } } mysession.setCart(new ShoppingCart()); … ShoppingCart cart = mysession.getCart(); cart.add(quantity, selectedProduct);
  39. 39. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  40. 40. RequestCycle • Encapsulates one request • Cleans up resources at end • Can be used as OpenSessionInViewFilter
  41. 41. RequestCycle 1. Create request cycle object 2. Decode the request 3. Identify request target (page, component, …) 4. Process event (onClick, onSubmit, …) 5. Respond (page, component, image, pdf, …) 6. Clean up
  42. 42. RequestCycle • Two types of requests: • Stateful • Stateless
  43. 43. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  44. 44. Component • encapsulate the programmatic manipulation of markup • can receive an event (onClick, onSubmit) • know how and where to render itself
  45. 45. Component • Ultimate super class wicket.Component Label ListView MultiLineLabel Loop TextField PagingNavigator PasswordTextField ImageMap Image Button Link Ajax… Tree Sorting, paging repeaters BookmarkablePageLink Wizard JasperReports DatePicker
  46. 46. Component + Markup • Component has wicket:id • Markup has same wicket:id • Hierarchy must match <h1 wicket:id=“msg”>Gets replaced</h1> new Label(“msg”, “Hello, World!”);
  47. 47. Component: Link <a href=”#” wicket:id=”link”>Click</a> Link link = new Link(“link”) { @Override public void onClick() { // do something setResponsePage(new NewPage()); } };
  48. 48. Component: AjaxLink <a href=”#” wicket:id=”link”>Click</a> someComponent.setOutputMarkupId(true); AjaxLink link = new AjaxLink(“link”) { public void onClick(AjaxRequestTarget t) { // do something t.addComponent(someComponent); t.appendJavaScript(“Effects.fade(‘foo’);”); } };
  49. 49. Component + Markup • Some components have own markup file • Put Java, markup and supporting files in same package on class path
  50. 50. A page: Hello, World!
  51. 51. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  52. 52. Behaviors • Plugins for components • Modify markup
  53. 53. Behavior link.add(new AbstractBehavior() { public void onComponentTag( Component component, ComponentTag tag) { tag.put(“onclick”, “return confirm(‘Are you sure?’);”); } }); Output: <a href=”...” onclick=”return confirm(‘....’);”>...</a>
  54. 54. Behaviors • Change attributes of your component’s markup • Add javascript events • Add Ajax behavior component.setOutputMarkupId(true); component.add( new AjaxSelfUpdatingBehavior(Duration.seconds(5)));
  55. 55. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  56. 56. Models • Models bind your POJO’s to Wicket components PropertyModel Label value (name) expression Person PropertyModel Label name value (zipcode) zipcode expression birthdate PropertyModel Label value (birthdate) expression
  57. 57. Java lazy binding sucks • Doesn’t update: new Label(“name”, person.getName()) • Null checks necessary: new Label(“street”, person.getAddress().getStreet())
  58. 58. Models • PropertyModel: new PropertyModel(p, “name) new PropertyModel(p, “address.street”) • CompoundPropertyModel: setModel(new CompoundPropertyModel(p)); add(new Label(“name”)); add(new Label(“address.street”));
  59. 59. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  60. 60. Roadmap 4/22/07 4/22-4/30 couple of weeks somewhere in june wicket 1.2.6 wicket 1.2.7 wicket 1.3.0 wicket 1.3.0 wicket 1.3.0 wicket 1.3.1 beta rc wicket x.y alpha Jav a 1.5 ap n in pro eed cu v s ba al to fro rP m M C
  61. 61. Roadmap • Release 1.3.0 (december) • Wicket 1.4/2.0 • Java 5!!!! • first milestone release after 1.3.1-ish
  62. 62. Conclusions • Easy creation and use of custom components • Up and coming framework • Popular • Great community
  63. 63. Questions?

×