{"id":48,"date":"2011-05-24T16:12:57","date_gmt":"2011-05-24T23:12:57","guid":{"rendered":"http:\/\/brie.com\/brian\/blog\/?p=48"},"modified":"2011-05-24T16:15:16","modified_gmt":"2011-05-24T23:15:16","slug":"wicket-adventures","status":"publish","type":"post","link":"https:\/\/brie.com\/brian\/blog\/?p=48","title":{"rendered":"Wicket Adventures"},"content":{"rendered":"<p>While the World Wide Web has been around for a long time, it seems like building web applications is still difficult. The problem, one has to write glue code to handle a lot of plumbing. I decided to try <a href=\"http:\/\/wicket.apache.org\">Wicket<\/a> and I believe there a number of good features about it. It leaves logic out of the web page so that web page designers can do their job and programmers can do theirs. I bought the book titled <em>Wicket in Action<\/em> by Martijn Dashortst and Eelco Hillenius. It has a series of <a href=\"https:\/\/code.google.com\/p\/wicketinaction\/\">examples<\/a>, but they are bundled into one giant application. At the same time, Maven provides an archetype that will build the basic layout and structure for a Wicket project. When I started with a base Wicket application from Maven, I was at a loss as how to get the example code from the book working. Here are my results. If the authors do a second edition, I hope they bridge this gap.<\/p>\n<p>In order to use the example code, you need two things: one, maven and two, a java compiler. To use maven, either apt-get install it or <a href=\"http:\/\/maven.apache.org\/download.html\">download it<\/a>. To see if both are working do the following.<\/p>\n<pre>$ javac -version\r\njavac 1.6.0_25<\/pre>\n<pre>$ mvn\r\n&lt;You should see some output here&gt;<\/pre>\n<p>Now, just download each of the zip files. To run it, do the following:<\/p>\n<pre>$ mvn jetty:run<\/pre>\n<p>Point your web browser to <a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a> and you are good to go.<\/p>\n<p>You can also import the project into Eclipse. First, make sure that you have the <a href=\"http:\/\/www.eclipse.org\/m2e\/\">Maven plugin<\/a>. Then, go to File-&gt;Import&#8230; <em>Existing Project<\/em> and select the project directory. If you want to make a war file for any of the sample projects, do the following:<\/p>\n<pre>$ mvn package<\/pre>\n<p>The resulting war file will be in the target directory.<\/p>\n<p>I put together projects that deal with and only with the concepts presented. These examples are from Chapter 3 that uses the Cheesr application.<\/p>\n<h2><a href=\"http:\/\/brie.com\/brian\/wicket\/giraffe.zip\">Girrafe<\/a><\/h2>\n<p>This code just does the basic layout using the Index.html as the main page, the Cheesr*.java classes to support the application. If you run it, you will get just the logo. But, it is a good starting point. <a href=\"http:\/\/brie.com\/brian\/wicket\/giraffe.zip \"><br \/>\nhttp:\/\/brie.com\/brian\/wicket\/giraffe.zip <\/a><\/p>\n<h2><a href=\"http:\/\/brie.com\/brian\/wicket\/zebra.zip\">Zebra<\/a><\/h2>\n<p>This adds the items to the page and the simple cart concept.<br \/>\n<a href=\"http:\/\/brie.com\/brian\/wicket\/zebra.zip\">http:\/\/brie.com\/brian\/wicket\/zebra.zip<\/a><\/p>\n<h2><a href=\"http:\/\/brie.com\/brian\/wicket\/zebra02.zip\">Zebra02<\/a><\/h2>\n<p>This adds the CheckOut panel and the checkout page. I also added a separate callback class for the add link. All the examples I have seen in the book contain anonymous inline classes (AIC). The downside is if you use the same logic in two different areas, you have to cut and paste. With a separate class, you can do code reuse. Plus, AICs look weird. Anyway, this is the demo of a separate callback the panel in addition to the checkout code. I like the Cheesr code. You can really see the power of Wicket.<br \/>\n<a href=\"http:\/\/brie.com\/brian\/wicket\/zebra02.zip\">http:\/\/brie.com\/brian\/wicket\/zebra02.zip<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While the World Wide Web has been around for a long time, it seems like building web applications is still difficult. The problem, one has to write glue code to handle a lot of plumbing. I decided to try Wicket &hellip; <a href=\"https:\/\/brie.com\/brian\/blog\/?p=48\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-wicket"],"_links":{"self":[{"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48"}],"version-history":[{"count":3,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":51,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions\/51"}],"wp:attachment":[{"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brie.com\/brian\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}