SlideServe
Menu
Préférences
© SlideServe · v2026

Apache Wicket

gaerwn avatar
16 diapositives · 393 Views · Jul 26, 2014

Apache Wicket. Component Based Web Development Framework. Wicket Agenda:. There is an overwhelming number of Java web frameworks available today, primarily distinguished by two main groups, Traditional – or – request based (Struts, Spring MVC…) and Component Based (Wicket, Tapestry...). .

Apache Wicket - slide 1
01 / 16Apache Wicket
1 / 17

Télécharger la présentation

Apache Wicket
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Apache Wicket Component Based Web Development Framework

  2. Wicket Agenda: There is an overwhelming number of Java web frameworks available today, primarily distinguished by two main groups, Traditional – or – request based (Struts, Spring MVC…) and Component Based (Wicket, Tapestry...).

  3. What is Wicket? • Open Source • Component Based • Enables component oriented, programmatic manipulation of markup • Pure Java & HTML • Clean separation of Java and HTML • The mission: bringing object oriented programming to the web application view layer

  4. Why use Wicket? • Integration • Spring • Guice • Hibernate and more… • State management • Clustering support • Back button support

  5. Why use Wicket cont.. • Ajax support without writing JavaScript! • Integration with some JavaScript libraries such as jQuery • URL Mounting • Pretty URLs • Component Level Security

  6. Core Wicket Concepts: The four most important wicket concepts that require understanding by any user, are Session, Components, Models, and Behaviors. Without these four main concepts you cannot manage dataflow throughout your wicket application.

  7. Pages & Panels • Page: • A representation of what is to be displayed to the user when the page is loaded. • Consists of HTML & Java • May contain 1 … N panels • Panel • Consists of HTML & Java • Reusable displayable component • May contain 1 … N panels

  8. Wicket and Sessions Wicket’s Session is an implementation of java’s HttpSession. • Stores Session specific data • Locale, client info • Logged in user • Shopping cart contents • Page history and back button support • And whatever else you need to maintain..

  9. Sessions are EASY with Wicket class MySession extends WebSession { private ShoppingCart cart; public ShoppingCartgetCart() { … } public void setCart(ShoppingCart cart) { … } } mysession.setCart(new ShoppingCart()); • The sessions is accessible from ALL pages / panels

  10. Components! • The ultimate superclass! • Encapsulate the programmatic manipulation of markup. • May receive events • onClick, onSubmit, etc.. • Know how and when to render themselves

  11. How components work. HTML Markup Java Code • <h1 wicket:id=“title”/> • <input wicket:id=“firstName”/> • Behaviors: • <button wicket:id=“addUser" type="submit" class="positive“> <b>Add User</b></button> • new Label(“title”, “It’s a Title!”); • new TextField(“firstName", new PropertyModel(user, "firstName")); • Behaviors • new Button("addUser", new Model<String>("Add User")) { • @Override • public void onSubmit() { • // do something here!!! • }

  12. Component Validation • Input validation is key in all web applications, fortunately Wicket makes this easy! TextFieldphoneNumberInput = new TextField("phoneNumberInput", new PropertyModel(currentUser, "phoneNumber")); phoneNumberInput.setRequired(true) .add(new StringValidator.ExactLengthValidator(10)) .add(new PatternValidator("[0-9]*"));

  13. Creating your own Components • Wicket is designed and intended for extension, if the provided components don’t do EXACTLY what you want, you can easily extend any of them!

  14. Wicket Models • Models bind your POJO’s to Wicket components Label(“name”, model) <<Person>> +name : String +city : String PropertyModel

  15. Example Models: • PropertyModel: • new PropertyModel(person, “name”) • new PropertyModel(person, “address.street”) • In Code: • Person person = new Person(); • new TextField(“firstName", new PropertyModel(person, "firstName"));

  16. Examples and Q & A