Apache Wicket Java Web Application Framework What is
Apache Wicket Java Web Application Framework
What is Wicket? Web Application Framework n Component-based Framework n Wicket 1. 4 is Java 1. 5+ compliant n
Where does Wicket fit?
Request / Response n JSP Request / Response
Model 2 (MVC) n Struts, Spring MVC, Stripes
Advantages of R/R Rendering views is generally quite fast n Development can leverage existing tag libraries n Recruiting developers may be easier n Modern implementations have good support for DI and Io. C frameworks n
Disadvantages of R/R Controller implementations must explicitly n consider multiple concurrent users and threads n Controllers generally work literally in terms of. HTTP requests and responses n Controllers often explicitly manage state n Not strictly Object Oriented n The programming model is skewed n
The Impedance Mismatch The Programming Model n Programming in Java - do we regularly focus on how the JVM manages object instances and variables? n Generally, website development requires an understanding of the HTTP protocol. n 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? n What if we considered a button. . . a Button? n And upon clicking a button, handled an on. Click event? n What if web-development resembled Swing or event-driven development? n What kind of framework could possibly enable this? ! n
Enter. . . Wicket Component-based framework n Instead of creating a controller, servlet or action class. . . create a Page n Place components on said Page and define how each component reacts to user input n • Build the Page in Java to manage HTML page elements. . . not the other way around n
Web App Config n web. xml
Wicket Config n Wicket. Application. java
General Structure Layout the element hierarchy n Style the elements n Markup (HTML’s Role) n Code (Java’s Role) n Properties Files n
Hello World n Markup n Java
Result
Forms (HTML) n Markup
Forms (Java) n Java
Component Family
Advantages POJO-centric n Avoid overuse of XML configuration files n Fully solve back button problem n Easy to create bookmarkable pages n Reusability n Easy to integrate with Java security n Compatible with any ordinary HTML editor n
Wicket Resources Wicket Links n http: //wicket. apache. org/ n http: //wicketstuff. org/ n http: //cwiki. apache. org/WICKET/ Wicket Books n Wicket in Action (Manning) n Pro Wicket (Apress)
- Slides: 20