SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Apache Wicket
                                Java Web Application Framework




St. Louis - Java User’s Group                                    Luther Baker • September 2009
What is Wicket?

• Web Application Framework

• Component-based Framework

• Wicket 1.4 is Java 1.5+ compliant
Where does Wicket fit?
                                 User




           Presentation Tier (Wicket)


 Shared          Business Tier
 Objects

                Integration Tier
Request / Response

JSP Request / Response


                                        home
                     request             jsp
browser                        server
          response
Model 2 (MVC)

Struts, Spring MVC, Stripes
                                           home
                                            jsp
                      request
browser                         server
           response
                                           home
                                         controller
Advantages of R/R

•   Rendering views is generally quite fast

•   Development can leverage existing tag libraries

•   Recruiting developers may be easier

•   Modern implementations have good support
    for DI and IoC frameworks
Disadvantages of R/R
•   Controller implementations must explicitly
    consider multiple concurrent users and threads

•   Controllers generally work literally in terms of
    HTTP requests and responses

•   Controllers often explicitly manage state

•   Not strictly Object Oriented

•   The programming model is skewed
The Impedance Mismatch
The Programming Model

  •   Programming in Java - do we regularly focus on how
      the JVM manages object instances and variables?

  •   Generally, website development requires an
      understanding of the HTTP protocol.

      IE: manually managing state within and across requests
      forces front end handlers to be protocol specific.
What if ... ?
•   What if we considered a page ... a Page?

•   What if we considered a button ... a Button?

•   And upon clicking a button, handled an onClick event?

•   What if web-development resembled Swing
    or event-driven development?

•   What kind of framework could possibly enable this?!
Enter ... Wicket
•   Component-based framework

•   Instead of creating a controller, servlet or action
    class ... create a Page

•   Place components on said Page and define how
    each component reacts to user input

•   Build the Page in Java to manage HTML page
    elements ... not the other way around
The Component Model
The Underlying Abstraction
   •   Graphic elements are laid out in HTML while their
       actual representation, behavior and implementation
       is defined in Java

   •   A DOM style parent/child approach

   •   An event-driven programming model

   •   You wonder ...
       “How can such an abstraction sit on top of HTTP?”
Web App Config
web.xml
   <web-app>

    <context-param>
      <param-name>configuration</param-name>
      <param-value>development</param-value>
    </context-param>

    <filter>
      <filter-name>WebApplication</filter-name>
        <filter-class>
          org.apache.wicket.protocol.http.WicketFilter
        </filter-class>
        <init-param>
          <param-name>applicationClassName</param-name>
          <param-value>mypackage.HelloWorldApplication</param-value>
        </init-param>
    </filter>

     <filter-mapping>
       <filter-name>WebApplication</filter-name>
       <url-pattern>/*</url-pattern>
     </filter-mapping>

   </web-app>
Wicket Config
WicketApplication.java
package mypackage;

import org.apache.wicket.protocol.http.WebApplication;

public class HelloWorldApplication extends WebApplication
{
    public Class getHomePage()
    {
        return HelloWorld.class;
    }
}
General Structure
Markup (HTML’s Role)
 •   Layout the element hierarchy

 •   Style the elements

Code (Java’s Role)
 •   Mirror and implement markup’s element hierarchy

 •   Event handling
Properties Files (~Auxiliary Roles)
 •   Literal strings and i18n
Hello World
Markup
  <html>
    <body>
      <span wicket:id="message">Message goes here!</span>
    </body>
  </html>


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

  public class HelloWorld extends WebPage
  {
    public HelloWorld()
    {
      add(new Label("message", "Hello World!"));
    }
  }
Forms (HTML)
Markup

<html>
  <body>
    <span wicket:id="message">Message goes here</span>
    <form wicket:id="messageInputForm">
       <input type="text" wicket:id="messageInput"/>
       <input type="submit" value="update"/>
    </form>
  </body>
</html>
Forms (Java)
Java
 public class HelloWorld extends WebPage
 {
   public HelloWorld()
   {
     IModel messageModel = new Model("Hello World!");
     add(new Label("message", messageModel));
     add(new MessageForm("messageInputForm", messageModel));
   }

     private final class MessageForm extends Form
     {
       public MessageForm(String id, IModel model)
       {
         super(id);
         add(new TextField("messageInput", model));
       }

         protected void onSubmit()
         {
           // nothing to do here as the model is automatically updated
         }
     }
 }
Component Family
                    Component                              Page
WebComponent                             Link
                           Panel
WebPage
                                                AjaxLink
               Button

 Checkbox                              TextArea
                            Form
            TextField
                                                DropDown
   Label
                        ...many more
Super Models
•   Static Model

•   Dynamic Model

•   Property Model

•   Compound Property

•   Loadable Detached
Basic Models
Static Model
   public class HelloWorld extends WicketExamplePage
   {
       public HelloWorld()
       {
            add(new Label ("name", new Model(person.getName())));
       }
   }



Dynamic Model
   personForm.add(new RequiredTextField("personName", new IModel<String>()
   {
       @Override
       public String getObject() {
            return person.getName();
       }

          @Override
          public void setObject(String value) {
              person.setName(value);
          }
   }));
More Models
Property Model
   public PropertyModel(final Object modelObject, final String expression)




   class Person                            class Address
   {                                       {
     private Address address;                private String zip;

       public Address getAddress()             public String getZip()
       {                                       {
         return name;                            return zip;
       }                                       }
       ...                                     ...
   }                                       }



   personForm.add(new RequiredTextField("zip",
                  new PropertyModel<Person>(person, "address.zip")));
Demonstration
WebPage Component
 • Java                   • HTML
   Subclass Master Page     child & parent tags

Custom Component
 • Java, HTML             • Child components
 • Panel Superclass       • Tags to include
Event Handling
 • Original HTML          • Ajax (Debug)
 • Generated Javascript   • Submit handling
Ideally Suited For ...
•   Highly interactive apps

•   Help-Desk style ticketing applications and online
    Registration applications

•   Apps with lots of Forms and/or UI controls

•   Apps requiring seamless Ajax behavior

•   Apps simulating thick clients

•   Anytime an event programming model better
    suites the problem domain
Deeper Dive
Maven Quickstart Archetype
 •   An easy way to start with a simple, Mavenized,
     Wicket project

Other Topics
 •   More on Models, Sessions and Security

 •   Unit Testing

 •   Custom components

 •   URL mapping, IoC Integration, Persistence ...
Wicket Resources
Wicket Links
     •   http://wicket.apache.org/

     •   http://wicketstuff.org/

     •   http://cwiki.apache.org/WICKET/


Wicket Books
     •   Wicket in Action (Manning)

     •   Pro Wicket (Apress)

Weitere ähnliche Inhalte

Was ist angesagt?

Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingAugusto Lazaro
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...Hariharan Ganesan
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django IntroductionGanga Ram
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsDinesh U
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js ExpressEyal Vardi
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentationBojan Golubović
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 

Was ist angesagt? (20)

Rest api with node js and express
Rest api with node js and expressRest api with node js and express
Rest api with node js and express
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Node.js
Node.jsNode.js
Node.js
 
JSON Schema Design
JSON Schema DesignJSON Schema Design
JSON Schema Design
 
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
 
Reactjs
Reactjs Reactjs
Reactjs
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
 
Introduction to MERN
Introduction to MERNIntroduction to MERN
Introduction to MERN
 
reactJS
reactJSreactJS
reactJS
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 

Andere mochten auch

Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)jcompagner
 
Apache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just JavaApache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just JavaMartijn Dashorst
 
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Baruch Sadogursky
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Michael Plöd
 
Wicket Introduction
Wicket IntroductionWicket Introduction
Wicket IntroductionEyal Golan
 
Importance of computers in military (2)
Importance of computers in military (2)Importance of computers in military (2)
Importance of computers in military (2)CheletteDanica1300511
 
Nursing technology informatics presentation
Nursing technology informatics presentationNursing technology informatics presentation
Nursing technology informatics presentationLeeann Sills
 

Andere mochten auch (11)

Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)Wicket Next (1.4/1.5)
Wicket Next (1.4/1.5)
 
Apache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just JavaApache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just Java
 
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
 
Wicket 2010
Wicket 2010Wicket 2010
Wicket 2010
 
What is sap
What is sapWhat is sap
What is sap
 
Adv and disadv of technology
Adv and disadv of technologyAdv and disadv of technology
Adv and disadv of technology
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
 
Wicket Introduction
Wicket IntroductionWicket Introduction
Wicket Introduction
 
Importance of computers in military (2)
Importance of computers in military (2)Importance of computers in military (2)
Importance of computers in military (2)
 
Nursing technology informatics presentation
Nursing technology informatics presentationNursing technology informatics presentation
Nursing technology informatics presentation
 
Importance of computers in Military
Importance of computers in MilitaryImportance of computers in Military
Importance of computers in Military
 

Ähnlich wie Apache Wicket Web Framework

Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...SPTechCon
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsGuy Nir
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsMike Subelsky
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892Tuna Tore
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentRob Windsor
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to TornadoGavin Roy
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Eric Palakovich Carr
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsSoós Gábor
 

Ähnlich wie Apache Wicket Web Framework (20)

Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
Advanced SharePoint 2010 and 2013 Web Part Development by Rob Windsor - SPTec...
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
 
Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)Unit 07: Design Patterns and Frameworks (3/3)
Unit 07: Design Patterns and Frameworks (3/3)
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.js
 

Kürzlich hochgeladen

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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Kürzlich hochgeladen (20)

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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Apache Wicket Web Framework

  • 1. Apache Wicket Java Web Application Framework St. Louis - Java User’s Group Luther Baker • September 2009
  • 2. What is Wicket? • Web Application Framework • Component-based Framework • Wicket 1.4 is Java 1.5+ compliant
  • 3. Where does Wicket fit? User Presentation Tier (Wicket) Shared Business Tier Objects Integration Tier
  • 4. Request / Response JSP Request / Response home request jsp browser server response
  • 5. Model 2 (MVC) Struts, Spring MVC, Stripes home jsp request browser server response home controller
  • 6. Advantages of R/R • Rendering views is generally quite fast • Development can leverage existing tag libraries • Recruiting developers may be easier • Modern implementations have good support for DI and IoC frameworks
  • 7. Disadvantages of R/R • Controller implementations must explicitly consider multiple concurrent users and threads • Controllers generally work literally in terms of HTTP requests and responses • Controllers often explicitly manage state • Not strictly Object Oriented • The programming model is skewed
  • 8. The Impedance Mismatch The Programming Model • Programming in Java - do we regularly focus on how the JVM manages object instances and variables? • Generally, website development requires an understanding of the HTTP protocol. IE: manually managing state within and across requests forces front end handlers to be protocol specific.
  • 9. What if ... ? • What if we considered a page ... a Page? • What if we considered a button ... a Button? • And upon clicking a button, handled an onClick event? • What if web-development resembled Swing or event-driven development? • What kind of framework could possibly enable this?!
  • 10. Enter ... Wicket • Component-based framework • Instead of creating a controller, servlet or action class ... create a Page • Place components on said Page and define how each component reacts to user input • Build the Page in Java to manage HTML page elements ... not the other way around
  • 11. The Component Model The Underlying Abstraction • Graphic elements are laid out in HTML while their actual representation, behavior and implementation is defined in Java • A DOM style parent/child approach • An event-driven programming model • You wonder ... “How can such an abstraction sit on top of HTTP?”
  • 12. Web App Config web.xml <web-app> <context-param> <param-name>configuration</param-name> <param-value>development</param-value> </context-param> <filter> <filter-name>WebApplication</filter-name> <filter-class> org.apache.wicket.protocol.http.WicketFilter </filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>mypackage.HelloWorldApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>WebApplication</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
  • 13. Wicket Config WicketApplication.java package mypackage; import org.apache.wicket.protocol.http.WebApplication; public class HelloWorldApplication extends WebApplication { public Class getHomePage() { return HelloWorld.class; } }
  • 14. General Structure Markup (HTML’s Role) • Layout the element hierarchy • Style the elements Code (Java’s Role) • Mirror and implement markup’s element hierarchy • Event handling Properties Files (~Auxiliary Roles) • Literal strings and i18n
  • 15. Hello World Markup <html> <body> <span wicket:id="message">Message goes here!</span> </body> </html> Java import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; public class HelloWorld extends WebPage { public HelloWorld() { add(new Label("message", "Hello World!")); } }
  • 16. Forms (HTML) Markup <html> <body> <span wicket:id="message">Message goes here</span> <form wicket:id="messageInputForm"> <input type="text" wicket:id="messageInput"/> <input type="submit" value="update"/> </form> </body> </html>
  • 17. Forms (Java) Java public class HelloWorld extends WebPage { public HelloWorld() { IModel messageModel = new Model("Hello World!"); add(new Label("message", messageModel)); add(new MessageForm("messageInputForm", messageModel)); } private final class MessageForm extends Form { public MessageForm(String id, IModel model) { super(id); add(new TextField("messageInput", model)); } protected void onSubmit() { // nothing to do here as the model is automatically updated } } }
  • 18. Component Family Component Page WebComponent Link Panel WebPage AjaxLink Button Checkbox TextArea Form TextField DropDown Label ...many more
  • 19. Super Models • Static Model • Dynamic Model • Property Model • Compound Property • Loadable Detached
  • 20. Basic Models Static Model public class HelloWorld extends WicketExamplePage { public HelloWorld() { add(new Label ("name", new Model(person.getName()))); } } Dynamic Model personForm.add(new RequiredTextField("personName", new IModel<String>() { @Override public String getObject() { return person.getName(); } @Override public void setObject(String value) { person.setName(value); } }));
  • 21. More Models Property Model public PropertyModel(final Object modelObject, final String expression) class Person class Address { { private Address address; private String zip; public Address getAddress() public String getZip() { { return name; return zip; } } ... ... } } personForm.add(new RequiredTextField("zip", new PropertyModel<Person>(person, "address.zip")));
  • 22. Demonstration WebPage Component • Java • HTML Subclass Master Page child & parent tags Custom Component • Java, HTML • Child components • Panel Superclass • Tags to include Event Handling • Original HTML • Ajax (Debug) • Generated Javascript • Submit handling
  • 23. Ideally Suited For ... • Highly interactive apps • Help-Desk style ticketing applications and online Registration applications • Apps with lots of Forms and/or UI controls • Apps requiring seamless Ajax behavior • Apps simulating thick clients • Anytime an event programming model better suites the problem domain
  • 24. Deeper Dive Maven Quickstart Archetype • An easy way to start with a simple, Mavenized, Wicket project Other Topics • More on Models, Sessions and Security • Unit Testing • Custom components • URL mapping, IoC Integration, Persistence ...
  • 25. Wicket Resources Wicket Links • http://wicket.apache.org/ • http://wicketstuff.org/ • http://cwiki.apache.org/WICKET/ Wicket Books • Wicket in Action (Manning) • Pro Wicket (Apress)