SlideShare a Scribd company logo
Wicket + JEE 6
       Michael Plöd
  Senacor Technologies AG
Agenda

• Brief Wicket Intro
• Standard Wicket - Spring App
• Integrating Wicket and EJB with CDI
• Integrating Wicket and Bean Validation
• Coding Example
Quickstart
mvn archetype:create
 -DarchetypeGroupId=org.apache.wicket
 -DarchetypeArtifactId=
       wicket-archetype-quickstart
 -DarchetypeVersion=1.4.13
 -DgroupId=com.senacor
 -DartifactId=wicket-example
WebApplication.java




                   wicket
HomePage.java         -               HomePage.html
                  example



                     web.xml
web.xml
   configures
Application
<web-app ... >
  <display-name>wicket-example</display-name>

  <filter>
  <filter-name>wicket.wicket-example</filter-name>
     <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
     <init-param>
       <param-name>applicationClassName</param-name>
        <param-value>com.senacor.WicketApplication</param-value>
     </init-param>
  </filter>

   <filter-mapping>
       <filter-name>wicket.wicket-example</filter-name>
     <url-pattern>/*</url-pattern>
   </filter-mapping>
</web-app>
Application
   is responsible for
bootstrapping
package com.senacor;

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

public class WicketApplication extends WebApplication
{
  public WicketApplication() {}

    public Class<HomePage> getHomePage()
    {
      return HomePage.class;
    }
}
no additional
configuration
WebApplication.java




                   wicket
HomePage.java         -               HomePage.html
                  example



                     web.xml
WebApplication.java




                   wicket
HomePage.java         -               HomePage.html
                  example



                     web.xml
Page
defines the Java part
HTML
defines the markup part
public class HomePage extends WebPage {
  public HomePage(final PageParameters parameters) {
     add(new Label("message",
              "If you see this message wicket is
               properly configured and running"));
  }
}
<html xmlns:wicket=
   "http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
  <head>
     <title>Wicket Quickstart Archetype Homepage</title>
  </head>
  <body>
     <strong>Wicket Quickstart Archetype Homepage</strong>
     <br/><br/>
     <span wicket:id="message">message will be here</span>
  </body>
</html>
<span wicket:id="message">message will be here</span>

add(new Label("message",
           "If you see this message wicket is
            properly configured and running"));
Spring                                        JEE



<span wicket:id="message">message will be here</span>

add(new Label("message",
           "If you see this message wicket is
            properly configured and running"));
Typical          Wicket
Wicket - Spring           @SpringBean
 Application
                   <Service>
                  Spring Bean

                          @Autowired


                  <Repository>
                   Spring Bean
public class HomePage extends WebPage {
  @SpringBean
  private PersonService personService;

    private class PersonListModel
      extends LoadableDetachableModel<List<Person>> {
        @Override
        protected List<Person> load() {
            return personService.listPersons();
        }
    }
    public HomePage(final PageParameters parameters) {
        ...
        final PropertyListView<Person> list =
          new PropertyListView<Person>("persons", new PersonListModel()) {
          ...
            }
        };
...
JSF                    Typical Java EE 6
          @ManagedBean +        Application
          @EJB / Inject

 <Service>
  EJB 3.1

          @Inject / @EJB


  <DAO>
EJB 3.1 / JPA
JSF
Wicket
  Wicket
                                     +
                          ?   Java EE6
 <Service>
  EJB 3.1

         @Inject / @EJB


  <DAO>
EJB 3.1 + JPA
Component wiring with CDI
     Weld / Seam Wicket Module
META-INF/beans.xml
or
WEB-INF/beans.xml
package com.senacor;

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

public class WicketApplication extends WeldApplication
{
  public WicketApplication() {}

    public Class<HomePage> getHomePage()
    {
      return HomePage.class;
    }
}
public class HomePage extends WebPage {
  @Inject
  private PersonService personService;

    private class PersonListModel
      extends LoadableDetachableModel<List<Person>> {
        @Override
        protected List<Person> load() {
            return personService.listPersons();
        }
    }
    public HomePage(final PageParameters parameters) {
        ...
        final PropertyListView<Person> list =
          new PropertyListView<Person>("persons", new PersonListModel()) {
          ...
            }
        };
...
„Programming today is a race
between software engineers striving
to build bigger and better idiot-proof
programs, and the universe trying to
build bigger and better idiots.

So far, the universe is winning.“
-- Robert Cringely --
Model
Validation
  with Wicket
Validate                      Validation
                 Conversion
mandatory                          of




       Back to input           Validation
         screen                    of




                 onSubmit       Update
                EventHandler    model
Validate                      Validation
                 Conversion
mandatory                          of




       Back to input           Validation
         screen                    of




                 onSubmit       Update
                EventHandler    model
form.add(new TextField("firstname").setRequired(true));

form.add(new TextField("email")
              .setRequired(true)
              .add(EmailAddressValidator.getInstance()));

form.add(new TextField("age")
              .add(NumberValidator.minimum(18)));

form.add(new TextField("username")
              .add(StringValidator.lengthBetween(6, 10)));

form.add(new TextField("username")
              .add(new PatternValidator("[a-zA-Z0-9]*"))
              .add(StringValidator.lengthBetween(6, 10)));
No support for
           Model
Bean Validation
    Validation
     in Wicket 1.4
       with Wicket
JSR-303 Wicket Validator

from Zenika
http://code.google.com/p/wicket-jsr303-validators/

http://blog.zenika.com/index.php?post/
2010/02/24/Wicket-JSR-303-Validators
public class Person {
  @NotNull private String firstname;
  @NotNull @EMail private String email;
  ...
}
form.setModel(new CompoundPropertyModel(new Person()));
form.add(new TextField("firstname"));
form.add(new TextField("email"));
form.add(new TextField("age"));
form.add(new TextField("password"));
form.add(new TextField("username"));
form.add(new JSR303FormValidator());
Live Coding
      example
https://github.com/mploed/wicketjee6-example
Further Reading
   Wicket In Action
   Martijn Dashorst, Eelco Hillenius
   Manning



   Wicket
   Roland Förther, Olaf Siefart, Carl-Eric Menzel
   dpunkt Verlag
Thank
     You!
     Michael Plöd
Senacor Technologies AG

More Related Content

What's hot (20)

PDF
Spring MVC
Aaron Schram
 
PPTX
Java Server Faces + Spring MVC Framework
Guo Albert
 
PDF
Getting Reactive with Spring Framework 5.0’s GA release
VMware Tanzu
 
PPTX
Spring MVC framework
Mohit Gupta
 
PDF
Spring MVC Framework
Hùng Nguyễn Huy
 
PDF
Spring mvc
Hamid Ghorbani
 
PPTX
Spring framework in depth
Vinay Kumar
 
PPTX
Introduction to spring boot
Santosh Kumar Kar
 
PDF
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
PDF
Spring Framework 5.2: Core Container Revisited
VMware Tanzu
 
ODP
Declarative Services Dependency Injection OSGi style
Felix Meschberger
 
PDF
Spring Framework - MVC
Dzmitry Naskou
 
PDF
JavaFX Enterprise (JavaOne 2014)
Hendrik Ebbers
 
PDF
Spring Boot
HongSeong Jeon
 
PPTX
Spring Web MVC
zeeshanhanif
 
ODP
Different Types of Containers in Spring
Sunil kumar Mohanty
 
ODP
Java Concurrent
NexThoughts Technologies
 
KEY
Multi Client Development with Spring
Joshua Long
 
PDF
Spring bean mod02
Guo Albert
 
PPTX
Angular 2
Pramod Raghav
 
Spring MVC
Aaron Schram
 
Java Server Faces + Spring MVC Framework
Guo Albert
 
Getting Reactive with Spring Framework 5.0’s GA release
VMware Tanzu
 
Spring MVC framework
Mohit Gupta
 
Spring MVC Framework
Hùng Nguyễn Huy
 
Spring mvc
Hamid Ghorbani
 
Spring framework in depth
Vinay Kumar
 
Introduction to spring boot
Santosh Kumar Kar
 
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
Spring Framework 5.2: Core Container Revisited
VMware Tanzu
 
Declarative Services Dependency Injection OSGi style
Felix Meschberger
 
Spring Framework - MVC
Dzmitry Naskou
 
JavaFX Enterprise (JavaOne 2014)
Hendrik Ebbers
 
Spring Boot
HongSeong Jeon
 
Spring Web MVC
zeeshanhanif
 
Different Types of Containers in Spring
Sunil kumar Mohanty
 
Java Concurrent
NexThoughts Technologies
 
Multi Client Development with Spring
Joshua Long
 
Spring bean mod02
Guo Albert
 
Angular 2
Pramod Raghav
 

Viewers also liked (6)

ODP
Wicket Next (1.4/1.5)
jcompagner
 
PDF
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Baruch Sadogursky
 
PDF
Apache Wicket: Web Applications With Just Java
Martijn Dashorst
 
PDF
Apache Wicket Web Framework
Luther Baker
 
KEY
Wicket 2010
Martijn Dashorst
 
PPT
Wicket Introduction
Eyal Golan
 
Wicket Next (1.4/1.5)
jcompagner
 
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Baruch Sadogursky
 
Apache Wicket: Web Applications With Just Java
Martijn Dashorst
 
Apache Wicket Web Framework
Luther Baker
 
Wicket 2010
Martijn Dashorst
 
Wicket Introduction
Eyal Golan
 
Ad

Similar to Integrating Wicket with Java EE 6 (20)

PDF
Wicket In Action - oredev2008
Martijn Dashorst
 
PDF
Wicket 10 years and beyond
Martijn Dashorst
 
PDF
Apache Wicket: 10 jaar en verder - Martijn Dashorst
NLJUG
 
PDF
Wicket Intro
koppenolski
 
PDF
Ikenna Okpala: London Java Community: Wicket and Scala - 27/07/2010.
Skills Matter
 
PDF
Short Lightening Talk
Ikenna Okpala
 
PDF
Wicket Deliver Your Webapp On Time
Will Hoover
 
ODP
Getting Started with Wicket
Maarten Hogendoorn
 
KEY
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
PDF
Wicket KT part 2
stuq
 
PDF
Wicket 6
codepitbull
 
PDF
Spark IT 2011 - Java EE 6 Workshop
Arun Gupta
 
PDF
Wicket Web Framework 101
Matthew McCullough
 
PDF
Keep your Wicket application in production
Martijn Dashorst
 
PPT
Component Framework Primer for JSF Users
Andy Schwartz
 
PPTX
Apache Wicket
Vít Kotačka
 
PDF
Spring 3 - An Introduction
Thorsten Kamann
 
PDF
Communication between Wicket and Flex
Hideyuki Takeuchi
 
KEY
Multi Client Development with Spring
Joshua Long
 
ODP
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
IndicThreads
 
Wicket In Action - oredev2008
Martijn Dashorst
 
Wicket 10 years and beyond
Martijn Dashorst
 
Apache Wicket: 10 jaar en verder - Martijn Dashorst
NLJUG
 
Wicket Intro
koppenolski
 
Ikenna Okpala: London Java Community: Wicket and Scala - 27/07/2010.
Skills Matter
 
Short Lightening Talk
Ikenna Okpala
 
Wicket Deliver Your Webapp On Time
Will Hoover
 
Getting Started with Wicket
Maarten Hogendoorn
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
Wicket KT part 2
stuq
 
Wicket 6
codepitbull
 
Spark IT 2011 - Java EE 6 Workshop
Arun Gupta
 
Wicket Web Framework 101
Matthew McCullough
 
Keep your Wicket application in production
Martijn Dashorst
 
Component Framework Primer for JSF Users
Andy Schwartz
 
Apache Wicket
Vít Kotačka
 
Spring 3 - An Introduction
Thorsten Kamann
 
Communication between Wicket and Flex
Hideyuki Takeuchi
 
Multi Client Development with Spring
Joshua Long
 
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
IndicThreads
 
Ad

More from Michael Plöd (13)

PDF
Event Sourcing: Einführung und Best Practices
Michael Plöd
 
PDF
Building Microservices with Event Sourcing and CQRS
Michael Plöd
 
PDF
Migrating from Grails 2 to Grails 3
Michael Plöd
 
PDF
Event Sourcing: Introduction & Challenges
Michael Plöd
 
PDF
Caching in Hibernate
Michael Plöd
 
PDF
Anatomie von Microservice Landschaften
Michael Plöd
 
PDF
Event Sourcing für reaktive Anwendungen
Michael Plöd
 
PDF
CQRS basierte Architekturen mit Microservices
Michael Plöd
 
PDF
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Michael Plöd
 
PDF
Caching - Hintergründe, Patterns und Best Practices
Michael Plöd
 
PDF
Warum empfehle ich meinen Kunden das Spring Framework?
Michael Plöd
 
PDF
Hibernate Tuning
Michael Plöd
 
PDF
Bessere Präsentationen
Michael Plöd
 
Event Sourcing: Einführung und Best Practices
Michael Plöd
 
Building Microservices with Event Sourcing and CQRS
Michael Plöd
 
Migrating from Grails 2 to Grails 3
Michael Plöd
 
Event Sourcing: Introduction & Challenges
Michael Plöd
 
Caching in Hibernate
Michael Plöd
 
Anatomie von Microservice Landschaften
Michael Plöd
 
Event Sourcing für reaktive Anwendungen
Michael Plöd
 
CQRS basierte Architekturen mit Microservices
Michael Plöd
 
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Michael Plöd
 
Caching - Hintergründe, Patterns und Best Practices
Michael Plöd
 
Warum empfehle ich meinen Kunden das Spring Framework?
Michael Plöd
 
Hibernate Tuning
Michael Plöd
 
Bessere Präsentationen
Michael Plöd
 

Recently uploaded (20)

PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
July Patch Tuesday
Ivanti
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 

Integrating Wicket with Java EE 6

  • 1. Wicket + JEE 6 Michael Plöd Senacor Technologies AG
  • 2. Agenda • Brief Wicket Intro • Standard Wicket - Spring App • Integrating Wicket and EJB with CDI • Integrating Wicket and Bean Validation • Coding Example
  • 3. Quickstart mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId= wicket-archetype-quickstart -DarchetypeVersion=1.4.13 -DgroupId=com.senacor -DartifactId=wicket-example
  • 4. WebApplication.java wicket HomePage.java - HomePage.html example web.xml
  • 5. web.xml configures Application
  • 6. <web-app ... > <display-name>wicket-example</display-name> <filter> <filter-name>wicket.wicket-example</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>com.senacor.WicketApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>wicket.wicket-example</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
  • 7. Application is responsible for bootstrapping
  • 8. package com.senacor; import org.apache.wicket.protocol.http.WebApplication; public class WicketApplication extends WebApplication { public WicketApplication() {} public Class<HomePage> getHomePage() { return HomePage.class; } }
  • 10. WebApplication.java wicket HomePage.java - HomePage.html example web.xml
  • 11. WebApplication.java wicket HomePage.java - HomePage.html example web.xml
  • 14. public class HomePage extends WebPage { public HomePage(final PageParameters parameters) { add(new Label("message", "If you see this message wicket is properly configured and running")); } } <html xmlns:wicket= "http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" > <head> <title>Wicket Quickstart Archetype Homepage</title> </head> <body> <strong>Wicket Quickstart Archetype Homepage</strong> <br/><br/> <span wicket:id="message">message will be here</span> </body> </html>
  • 15. <span wicket:id="message">message will be here</span> add(new Label("message", "If you see this message wicket is properly configured and running"));
  • 16. Spring JEE <span wicket:id="message">message will be here</span> add(new Label("message", "If you see this message wicket is properly configured and running"));
  • 17. Typical Wicket Wicket - Spring @SpringBean Application <Service> Spring Bean @Autowired <Repository> Spring Bean
  • 18. public class HomePage extends WebPage { @SpringBean private PersonService personService; private class PersonListModel extends LoadableDetachableModel<List<Person>> {         @Override         protected List<Person> load() {             return personService.listPersons();         }     } public HomePage(final PageParameters parameters) { ... final PropertyListView<Person> list = new PropertyListView<Person>("persons", new PersonListModel()) {           ...             }         }; ...
  • 19. JSF Typical Java EE 6 @ManagedBean + Application @EJB / Inject <Service> EJB 3.1 @Inject / @EJB <DAO> EJB 3.1 / JPA
  • 20. JSF
  • 21. Wicket Wicket + ? Java EE6 <Service> EJB 3.1 @Inject / @EJB <DAO> EJB 3.1 + JPA
  • 22. Component wiring with CDI Weld / Seam Wicket Module
  • 24. package com.senacor; import org.apache.wicket.protocol.http.WebApplication; public class WicketApplication extends WeldApplication { public WicketApplication() {} public Class<HomePage> getHomePage() { return HomePage.class; } }
  • 25. public class HomePage extends WebPage { @Inject private PersonService personService; private class PersonListModel extends LoadableDetachableModel<List<Person>> {         @Override         protected List<Person> load() {             return personService.listPersons();         }     } public HomePage(final PageParameters parameters) { ... final PropertyListView<Person> list = new PropertyListView<Person>("persons", new PersonListModel()) {           ...             }         }; ...
  • 26. „Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning.“ -- Robert Cringely --
  • 28. Validate Validation Conversion mandatory of Back to input Validation screen of onSubmit Update EventHandler model
  • 29. Validate Validation Conversion mandatory of Back to input Validation screen of onSubmit Update EventHandler model
  • 30. form.add(new TextField("firstname").setRequired(true)); form.add(new TextField("email") .setRequired(true) .add(EmailAddressValidator.getInstance())); form.add(new TextField("age") .add(NumberValidator.minimum(18))); form.add(new TextField("username") .add(StringValidator.lengthBetween(6, 10))); form.add(new TextField("username") .add(new PatternValidator("[a-zA-Z0-9]*")) .add(StringValidator.lengthBetween(6, 10)));
  • 31. No support for Model Bean Validation Validation in Wicket 1.4 with Wicket
  • 32. JSR-303 Wicket Validator from Zenika http://code.google.com/p/wicket-jsr303-validators/ http://blog.zenika.com/index.php?post/ 2010/02/24/Wicket-JSR-303-Validators
  • 33. public class Person { @NotNull private String firstname; @NotNull @EMail private String email; ... } form.setModel(new CompoundPropertyModel(new Person())); form.add(new TextField("firstname")); form.add(new TextField("email")); form.add(new TextField("age")); form.add(new TextField("password")); form.add(new TextField("username")); form.add(new JSR303FormValidator());
  • 34. Live Coding example https://github.com/mploed/wicketjee6-example
  • 35. Further Reading Wicket In Action Martijn Dashorst, Eelco Hillenius Manning Wicket Roland Förther, Olaf Siefart, Carl-Eric Menzel dpunkt Verlag
  • 36. Thank You! Michael Plöd Senacor Technologies AG

Editor's Notes