SlideShare uma empresa Scribd logo
1 de 65
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!”));
                    =
         <h1>Hello, World!</h1>
A brief history of Wicket
• Discovery of the Hobbit
  • Year of the monkey
  • Milau bridge opens




                                                           2004
photo by: 5lab (http://flickr.com/photos/5lab/382292934/)
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




                                   Wicket
JSF guy           WebWork           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




             Joined
             Apache
Wicket uptake

Dice (US)       15

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

Java Software


Apache Software Foundation


Web frameworks
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
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</version>
</dependency>
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>
          org.apache.wicket.protocol.http.WicketFilter
      </filter-class>
      <init-param>
          <param-name>applicationClassName</param-name>
          <param-value>example.MyApplication</param-value>
      </init-param>
    </filter>
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() { … }
   public void setCart(ShoppingCart cart) { … }
}
mysession.setCart(new ShoppingCart());
…
ShoppingCart cart = mysession.getCart();
cart.add(quantity, selectedProduct);
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. Process event (onClick, onSubmit, …)
5. Respond (page, component, image, pdf, …)
6. Clean up
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 and where to render itself
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
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!”);
Component: Link
<a href=”#” wicket:id=”link”>Click</a>

Link link = new Link(“link”) {
   @Override public void onClick() {
      // do something
      setResponsePage(new NewPage());
   }
};
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’);”);
   }
};
Component + Markup

• Some components
  have own markup file
• Put Java, markup and
  supporting files in
  same package on class
  path
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) {
      tag.put(“onclick”, “return confirm(‘Are you sure?’);”);
    }
});

Output:
<a href=”...” onclick=”return confirm(‘....’);”>...</a>
Behaviors
  • Change attributes of your component’s
     markup
  • Add javascript events
  • Add Ajax behavior
component.setOutputMarkupId(true);
component.add(
  new AjaxSelfUpdatingBehavior(Duration.seconds(5)));
Concepts
• Application
• Session
• RequestCycle
• Components
• Behaviors
• Models
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
Java lazy binding sucks

• Doesn’t update:
  new Label(“name”, person.getName())
• Null checks necessary:
  new Label(“street”,
         person.getAddress().getStreet())
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”));
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                         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
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?

Mais conteúdo relacionado

Mais de Martijn Dashorst

HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0Martijn Dashorst
 
From Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud DeploymentsFrom Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud DeploymentsMartijn Dashorst
 
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQLConverting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQLMartijn Dashorst
 
Solutions for when documentation fails
Solutions for when documentation fails Solutions for when documentation fails
Solutions for when documentation fails Martijn Dashorst
 
Whats up with wicket 8 and java 8
Whats up with wicket 8 and java 8Whats up with wicket 8 and java 8
Whats up with wicket 8 and java 8Martijn Dashorst
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep DiveMartijn Dashorst
 
Scrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijsScrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijsMartijn Dashorst
 
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)Martijn Dashorst
 
Wicket 10 years and beyond
Wicket   10 years and beyond Wicket   10 years and beyond
Wicket 10 years and beyond Martijn Dashorst
 
Vakmanschap is meesterschap
Vakmanschap is meesterschapVakmanschap is meesterschap
Vakmanschap is meesterschapMartijn Dashorst
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in productionMartijn Dashorst
 
Guide To Successful Graduation at Apache
Guide To Successful Graduation at ApacheGuide To Successful Graduation at Apache
Guide To Successful Graduation at ApacheMartijn Dashorst
 

Mais de Martijn Dashorst (20)

HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
 
From Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud DeploymentsFrom Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud Deployments
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
 
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQLConverting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQL
 
Solutions for when documentation fails
Solutions for when documentation fails Solutions for when documentation fails
Solutions for when documentation fails
 
Whats up with wicket 8 and java 8
Whats up with wicket 8 and java 8Whats up with wicket 8 and java 8
Whats up with wicket 8 and java 8
 
Code review drinking game
Code review drinking gameCode review drinking game
Code review drinking game
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep Dive
 
Code review drinking game
Code review drinking gameCode review drinking game
Code review drinking game
 
Scrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijsScrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijs
 
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
 
De schone coder
De schone coderDe schone coder
De schone coder
 
Wicket 10 years and beyond
Wicket   10 years and beyond Wicket   10 years and beyond
Wicket 10 years and beyond
 
The State of Wicket
The State of WicketThe State of Wicket
The State of Wicket
 
Wicket 2010
Wicket 2010Wicket 2010
Wicket 2010
 
Vakmanschap is meesterschap
Vakmanschap is meesterschapVakmanschap is meesterschap
Vakmanschap is meesterschap
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in production
 
Guide To Successful Graduation at Apache
Guide To Successful Graduation at ApacheGuide To Successful Graduation at Apache
Guide To Successful Graduation at Apache
 
Wicket In Action
Wicket In ActionWicket In Action
Wicket In Action
 
Wicket Live on Stage
Wicket Live on StageWicket Live on Stage
Wicket Live on Stage
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

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
  • 7. Wicket • Component oriented • Open source • Web application framework • Java+HTML
  • 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.
  • 16. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  • 17. 2005 • Dr. Who returns • A380’s maiden flight • Huygens lands on Titan
  • 22. JavaOne’05 Tapestry guy Bald Struts/Shale guy guy Wicket JSF guy WebWork guy guy
  • 26. Wicket uptake Wicket 1.2 released Wicket 1.0 released
  • 27. Wicket uptake Wicket 1.2 released Wicket 1.0 released Joined Apache
  • 28. Wicket uptake Dice (US) 15 Indeed (US) 85 Monster 29 (world)
  • 29. Popular? Java Software Apache Software Foundation Web frameworks
  • 30. 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
  • 31. Getting Wicket • Everybody gets the ultimate edition • Includes sources • Currently 1.3-rc1 • Or...
  • 32. Use maven <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket</artifactId> <version>1.3.0-rc1</version> </dependency>
  • 33.
  • 34. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  • 35. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 36. Application • Main entry point for your web application • Initialization • Configuration • Homepage • Factories
  • 37. 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>
  • 38. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 39. Session • Abstraction of a user session • Stores session specific data
  • 40. 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);
  • 41. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 42. RequestCycle • Encapsulates one request • Cleans up resources at end • Can be used as OpenSessionInViewFilter
  • 43. 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
  • 44. RequestCycle • Two types of requests: • Stateful • Stateless
  • 45. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 46. Component • encapsulate the programmatic manipulation of markup • can receive an event (onClick, onSubmit) • know how and where to render itself
  • 47. 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
  • 48. 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!”);
  • 49. Component: Link <a href=”#” wicket:id=”link”>Click</a> Link link = new Link(“link”) { @Override public void onClick() { // do something setResponsePage(new NewPage()); } };
  • 50. 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’);”); } };
  • 51. Component + Markup • Some components have own markup file • Put Java, markup and supporting files in same package on class path
  • 52. A page: Hello, World!
  • 53. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 54. Behaviors • Plugins for components • Modify markup
  • 55. 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>
  • 56. Behaviors • Change attributes of your component’s markup • Add javascript events • Add Ajax behavior component.setOutputMarkupId(true); component.add( new AjaxSelfUpdatingBehavior(Duration.seconds(5)));
  • 57. Concepts • Application • Session • RequestCycle • Components • Behaviors • Models
  • 58. 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
  • 59. Java lazy binding sucks • Doesn’t update: new Label(“name”, person.getName()) • Null checks necessary: new Label(“street”, person.getAddress().getStreet())
  • 60. 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”));
  • 61. Agenda • What is Wicket? • Wicket concepts • Wicket roadmap
  • 62. 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
  • 63. Roadmap • Release 1.3.0 (december) • Wicket 1.4/2.0 • Java 5!!!! • first milestone release after 1.3.1-ish
  • 64. Conclusions • Easy creation and use of custom components • Up and coming framework • Popular • Great community