Apache Wicket: Web Applications With Just Java

  • 14,455 views
Uploaded on

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

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

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • 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
    Are you sure you want to
    Your message goes here
  • good one ,,,,, can the author mail me this ppt at kcchat@gmail.com .... :) .... Thanks n Regards..
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
14,455
On Slideshare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
0
Comments
2
Likes
16

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Apache Wicket Web applications with just Java
  • 2. Martijn Dashorst • Committer • Chair • Author
  • 3. Martijn Dashorst • Committer • Chair • Author
  • 4. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  • 5. Wicket?
  • 6. Wicket?
  • 7. Wicket • Component oriented • Open source • Web application framework • Java+HTML
  • 8. Hello, World!
  • 9. Hello, World!
  • 10. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1>
  • 11. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1> + add(new Label(“msg”, “Hello, World!”));
  • 12. Hello, World! <h1 wicket:id=”msg”>[text goes here]</h1> + add(new Label(“msg”, “Hello, World!”)); = <h1>Hello, World!</h1>
  • 13. A brief history of Wicket
  • 14. • Discovery of the Hobbit • Year of the monkey • Milau bridge opens 2004 photo by: 5lab (http://flickr.com/photos/5lab/382292934/)
  • 15. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  • 16. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  • 17. First Wicket meetup
  • 18. First Wicket meetup
  • 19. First Wicket meetup
  • 20. JavaOne’05
  • 21. JavaOne’05 Tapestry guy Bald Struts/Shale guy guy Wicket JSF guy WebWork guy guy
  • 22. JavaOne’05 Wicket 1.0
  • 23. Wicket uptake
  • 24. Wicket uptake Wicket 1.0 released
  • 25. Wicket uptake Wicket 1.2 released Wicket 1.0 released
  • 26. Wicket uptake Wicket 1.2 released Wicket 1.0 released Joined Apache
  • 27. Wicket uptake Dice (US) 15 Indeed (US) 85 Monster 29 (world)
  • 28. Popular? Java Software Apache Software Foundation Web frameworks
  • 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. Getting Wicket • Everybody gets the ultimate edition • Includes sources • Currently 1.3-rc1 • Or...
  • 31. Use maven <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket</artifactId> <version>1.3.0-rc1</version> </dependency>
  • 32. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  • 33. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 34. Application • Main entry point for your web application • Initialization • Configuration • Homepage • Factories
  • 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. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 37. Session • Abstraction of a user session • Stores session specific data
  • 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. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 40. RequestCycle • Encapsulates one request • Cleans up resources at end • Can be used as OpenSessionInViewFilter
  • 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. RequestCycle • Two types of requests: • Stateful • Stateless
  • 43. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 44. Component • encapsulate the programmatic manipulation of markup • can receive an event (onClick, onSubmit) • know how and where to render itself
  • 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. 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. Component: Link <a href=”#” wicket:id=”link”>Click</a> Link link = new Link(“link”) { @Override public void onClick() { // do something setResponsePage(new NewPage()); } };
  • 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. Component + Markup • Some components have own markup file • Put Java, markup and supporting files in same package on class path
  • 50. A page: Hello, World!
  • 51. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 52. Behaviors • Plugins for components • Modify markup
  • 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. 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. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 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. Java lazy binding sucks • Doesn’t update: new Label(“name”, person.getName()) • Null checks necessary: new Label(“street”, person.getAddress().getStreet())
  • 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. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  • 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. Roadmap • Release 1.3.0 (december) • Wicket 1.4/2.0 • Java 5!!!! • first milestone release after 1.3.1-ish
  • 62. Conclusions • Easy creation and use of custom components • Up and coming framework • Popular • Great community
  • 63. Questions?