1 / 24

Wicket in 60 Minutes

Wicket in 60 Minutes. Wicket 4 Newbs. Even Voorstellen . Agenda. Waarom Wicket?. Basis Ingredienten Wicket Applicatie. Demo: Hello World! met Maven en Wicket. Enkele Wicket Componenten. Demo: Wicked Bookstore. Waarom Wicket?. (Hadden nog niet genoeg web frameworks?). Jawel .

tod
Télécharger la présentation

Wicket in 60 Minutes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wicket in 60 Minutes Wicket 4 Newbs

  2. Even Voorstellen ...

  3. Agenda • Waarom Wicket? • Basis Ingredienten Wicket Applicatie • Demo: Hello World! met Maven en Wicket • Enkele Wicket Componenten • Demo: Wicked Bookstore

  4. Waarom Wicket? (Hadden nog niet genoeg web frameworks?)

  5. Jawel ...

  6. Maar Wicket ... • Is Component Oriented • Houd HTML en Java Strikt Gescheiden • Heeft Geen XML configuratie nodig!

  7. Wicket is Component Oriented Composite Pattern

  8. Wicket is Component Oriented Voorbeeld: Form Components

  9. HTML mark-up: <p wicket:id="quoteOfDay">famous quote here</p> Java code: String quoteNeilArmstrong= ”This is one small step for a man, “ + “one giant leap for mankind."; add(new Label("quoteOfDay", quoteNeilArmstrong)); Java en HTML Gescheiden

  10. Geen XML Configuraties Meer! <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <!-- ========== Form Bean Definitions ============ --> <form-beans> <form-bean name="loginFormBean" type="test.struts.LoginForm" /> (...) </form-beans> <!-- ========== Action Mapping Definitions ======== --> <action-mappings> <action path="/login" type="test.struts.LoginAction" > <forward name="valid" path="/jsp/MainMenu.jsp" /> <forward name="invalid" path="/jsp/LoginView.jsp" /> </action> (...) </action-mappings> </struts-config>

  11. Wat gaat er in de soep? Wicket Basis Ingredienten

  12. Wicket Basis Ingredienten • Wicket dependency in pom.xml • Wicket Servlet Filter in web.xml • WebApplication class • WebPage class • HTML template ( + CSS )

  13. Wicket ‘core’ library: <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket</artifactId> <version>${wicket.version}</version> </dependency> Wicket Spring integratie library: <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket-spring</artifactId> <version>${wicket.version}</version> </dependency> Dependencies in pom.xml

  14. Servlet Filter in web.xml <filter> <filter-name>wicket.helloworld</filter-name> <filter-class> org.apache.wicket.protocol.http.WicketFilter </filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value> nl.iprofs.MyWicketApplication </param-value> </init-param> </filter> <filter-mapping> <filter-name>wicket.helloworld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

  15. WebApplication Class package nl.iprofs; import org.apache.wicket.protocol.http.WebApplication; publicclass WicketApplication extends WebApplication { public MyWicketApplication() {} public Class getHomePage() { return HomePage.class; } }

  16. WebPage Class package nl.iprofs; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.WebPage; publicclass HomePage extends WebPage { public HomePage(final PageParameters parameters) { String neilArmstrongQuote = "This is one small step for a man, " + "one giant leap for mankind"; add( new Label("quoteOfDay", neilArmstrongQuote)); } }

  17. HTML Template <html> <head> <title>Quote of the Day</title> </head> <body> <h1>Quote of the Day</h1> <p wicket:id="quoteOfDay">famous quote here</p> </body> </html>

  18. Demo Hello Wicked World

  19. Wicket Componenten

  20. Wicket Component Structuur

  21. HTML mark-up: <a href="#" wicket:id="homeLink">Home</a><br /> Java code: Link homeLink = new BookmarkablePageLink("homeLink", HomePage.class); Link Component

  22. HTML mark-up: <div wicket:id="categoryRow"> <a href="#" wicket:id="catLink"> <span wicket:id="catLabel">Boek A</span></a> </div> Java code: add(new ListView("categoryRow", categorieen) { @Override protectedvoid populateItem(ListItem item) { Category category = (Category) item.getModelObject(); Link catLink = new BookmarkablePageLink( "catLink", HomePage.class); catLink.add(new Label("catLabel", category.getName())); item.add(catLink); } }); ListView Component

  23. Demo WickedBookstore

  24. Vragen ... en antwoorden

More Related