Web Development with just Java and HTML

47 slides
0.62 MB

Similar Presentations

Presentation Transcript


Apache Wicket: web applications with just Java Xavier Hanin JavaZone ‘07


Who is Xavier HaninIndependent Java Consultant Customers Open Source Renault


AgendaWhat is Wicket Core concepts of Wicket Developing a custom component Q&A


Wicket in a NutshellOpen Source (Apache Software Foundation) Component based Pure Java + Pure HTML Simple Enthusiastic community


What is Wicket?The technology: enabling component-oriented, programmatic manipulation of markup The mission: bringing object oriented programming to the web application view layer The reward: have a fun job and be good friends with your manager again


Achieving these goals throughKeeping simple things simple Utilizing an object-oriented component model where components are truly self contained Re-applying the Model View Controller pattern on components instead of requests, with models as first class citizens Having a clean separation of concerns between HTML and Java


Achieving these goals throughProviding transparent, fully automated state management Keeping configuration needs to the minimum No more XML! Making using & creating custom components easier than any framework out there


Component versus ‘traditional’Traditional Struts, WebWork, Spring MVC, etc. Proven for web A lot of web developers available Components JSF, Wicket, Tapestry, etc. Traditional model for UI development on thick clients A lot of developers available


FeaturesPage composition panels, borders and markup inheritance Excellent localization and style support template and resource loading (_be.html, .xml) localized models (e.g. for labels) sophisticated resource bundle lookup (composition & inheritance hierarchy) automatic client capabilities detection


FeaturesIntegration Spring Guice Hibernate JasperReports OSGi Fancy components sortable, filterable, pageable, data aware tables date picker, rich text editor, Google Maps tabbed panel, navigation, tree, wizard


FeaturesState management type safe sessions clustering support back button support Double submit strategies render redirect/ redirect to buffered response/ none Testing support JUnit testing extensive logging and error reporting


FeaturesAjax support and components Ajax without writing JavaScript, Dojo, Scriptaculous, ... Header contribution Javascript & CSS URL mounting pretty URLs Component level security


AgendaWhat is Wicket Core concepts of Wicket Developing a custom component Q&A


Wicket’s conceptsApplication Session RequestCycle Components Behaviors Models


ApplicationMain entry point for your web application Configuration Output Wicket specific tags? Watch for markup changes every …? Defines homepage Factories for Session RequestCycle Security …


ApplicationConfigured in web.xml: wicket org.apache.wicket.protocol.http.WicketFilter applicationClassName example.MyApplication 1


Wicket’s conceptsApplication Session RequestCycle Components Behaviors Models


SessionAbstraction of a user session Storage typically in HttpSession Stores session specific data Locale, Client info (browser vendor and version) Your own data? Logged in user Shopping cart contents Limited page history for back button support


Sessionclass MySession extends WebSession { private ShoppingCart cart; public ShoppingCart getCart() { … } public void setCart(ShoppingCart cart) { … } } mysession.setCart(new ShoppingCart()); … ShoppingCart cart = mysession.getCart(); cart.add(quantity, selectedProduct);


Wicket’s conceptsApplication Session RequestCycle Components Behaviors Models


RequestCycleSteps in a request cycle: Create request cycle object Decode the request Identify request target (page, component, …) Process event (onClick, onSubmit, …) Respond (page, component, image, pdf, …) Clean up


RequestCycleTwo types of requests: Stateful Tied to specific user session Not bookmarkable Stateless Not necessarily tied to specific user session Bookmarkable


Wicket’s conceptsApplication Session RequestCycle Components Behaviors Models


Componentsencapsulate the programmatic manipulation of markup can receive an event onClick, onSubmit know how and where to render itself


ComponentUltimate super class wicket.ComponentLabel MultiLineLabel TextField PasswordTextField Image Link Tree BookmarkablePageLink JasperReportsListView Loop PagingNavigator ImageMap Button Ajax… Sorting, paging repeaters Wizard DatePicker


Components and markupA component is identified in markup with wicket:id Html:

Gets replaced

Java: new Label(“msg”, “Hello, World!”); Final (wicket tags can be stripped):

Hello, World!

Browse More Presentations

Last Updated: 8th March 2018

Recommended PPTs