<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>JavaGeek.org - Wicket category</title>
  <link>http://javageek.org/categories/java/wicket/</link>
  <description>For the love of Java</description>
  <language>en</language>
  <copyright>Guillermo Castro</copyright>
  <lastBuildDate>Mon, 27 Apr 2009 22:05:14 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>5 Days of Wicket - Designing the backend</title>
    <link>http://www.mysticcoders.com/blog/2009/03/11/5-days-of-wicket-day-designing-the-backend/</link>
    
      
        <description>
          &lt;p&gt;
&lt;i&gt;&lt;a href=&#034;http://www.mysticcoders.com/blog/2009/03/11/5-days-of-wicket-day-designing-the-backend/&#034;&gt;5 Days of Wicket - Designing the backend&lt;/a&gt;&lt;/i&gt; is an article written by yours truly as part of a series of articles geared towards the better understanding of how to create a web application using &lt;a href=&#034;http://wicket.apache.org/&#034;&gt;Apache Wicket&lt;/a&gt;. Enjoy.
&lt;/p&gt;
&lt;p&gt;
(You can read a short introduction to the series of the articles and links to the rest of them &lt;a href=&#034;http://www.mysticcoders.com/blog/2009/03/09/5-days-of-wicket/&#034;&gt;here&lt;/a&gt;)
&lt;/p&gt;&lt;p&gt;&lt;a href=&#034;http://www.mysticcoders.com/blog/2009/03/11/5-days-of-wicket-day-designing-the-backend/&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2009/03/11/5_days_of_wicket_designing_the_backend.html&#034;
    dc:identifier=&#034;http://javageek.org/2009/03/11/5_days_of_wicket_designing_the_backend.html&#034;
    dc:title=&#034;5 Days of Wicket - Designing the backend&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1236788020238&amp;token=-3307744560510294916&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Wicket</category>
    
    <category>Tips</category>
    
    <comments>http://javageek.org/2009/03/11/5_days_of_wicket_designing_the_backend.html#comments</comments>
    <guid isPermaLink="true">http://www.mysticcoders.com/blog/2009/03/11/5-days-of-wicket-day-designing-the-backend/</guid>
    <pubDate>Wed, 11 Mar 2009 16:13:40 GMT</pubDate>
  </item>
  
  <item>
    <title>Migrating wicket-example to Wicket 1.2 (beta 1)</title>
    <link>http://javageek.org/2006/03/14/migrating_wicket_example_to_wicket_1_2_beta_1.html</link>
    
      
        <description>
          &lt;blockquote&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;UPDATE:&lt;/span&gt; I changed the BlogApplication code based on feedback from Igor (one of the Wicket developers). It should now work against the latest trunk from the Subversion repository.&lt;/blockquote&gt;Well, &lt;a href=&#034;http://javageek.org/2006/03/08/comparing_web_frameworks_wicket.html&#034;&gt;my last entry&lt;/a&gt; had some &lt;a href=&#034;http://www.theserverside.com/news/thread.tss?thread_id=39358&#034;&gt;very&lt;/a&gt; &lt;a href=&#034;http://www.javalobby.org/java/forums/t65452.html&#034;&gt;good&lt;/a&gt; &lt;a href=&#034;http://www.artima.com/forums/flat.jsp?forum=276&amp;amp;thread=151519&#034;&gt;feedback&lt;/a&gt; from you. It seems people really are interested in learning Wicket, and someone even told me that his boss asked him to evaluate Wicket after reading my article. That kind of reaction for me is both a blessing and a curse. A blessing because I feel good with this kind of response, but a curse (in a good way) because now I want to give more, something that&#039;s not always easy to do, as I do have a day job.&lt;br /&gt;&lt;br /&gt;My interest in Wicket comes from the fact that I like the way the framework works. And I&#039;m sure that the more I learn about Wicket, the more I will be able to share with you how to do things. There are a couple of &lt;a href=&#034;http://www.javalobby.org/java/forums/t60786.html&#034;&gt;introductory articles&lt;/a&gt; already, and the &lt;a href=&#034;http://wicket.sourceforge.net/wiki&#034;&gt;wiki pages&lt;/a&gt; also provide good reference points, but there&#039;s nothing like a practical example to understand what&#039;s going on (at least I learn better by example).&lt;br /&gt;&lt;br /&gt;And speaking of examples, the example I created for the article used Wicket 1.1.1, but Wicket 1.2 is just around the corner, and barring some last minute critical API changes, it should be stable enough for people to use it.&lt;br /&gt;&lt;br /&gt;Migrating the example to 1.2 was actually very easy. All I had to do was to put the new wicket-1.2-beta1.jar file in my lib folder, take out the old jar (of course) and also the ognl jar which is no longer needed, as Wicket now provides its own internal Object-Graph navigation. I also had to modify two classes: BlogApplication and ViewBlogEntry.&lt;br /&gt;&lt;br /&gt;The new BlogApplication class now looks like:&lt;blockquote class=&#034;codeSample&#034;&gt;package org.javageek.wicket;&lt;br /&gt;&lt;br /&gt;import wicket.Application;&lt;br /&gt;import wicket.protocol.http.WebApplication;&lt;br /&gt;import wicket.settings.IMarkupSettings;&lt;br /&gt;import domain.Blog;&lt;br /&gt;import domain.BlogService;&lt;br /&gt;&lt;br /&gt;public class BlogApplication extends WebApplication {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private BlogService blogService = new BlogService();&lt;br /&gt;&lt;br /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override protected void init() {&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; IMarkupSettings markupSettings = getMarkupSettings();&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; configure(DEVELOPMENT);&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; markupSettings.setStripWicketTags(true);&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; markupSettings.setDefaultMarkupEncoding(&amp;quot;UTF-8&amp;quot;);&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; markupSettings.setStripXmlDeclarationFromOutput(false);&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override public Class getHomePage() {&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return Index.class;&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br style=&#034;font-weight: bold;&#034; /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static final BlogApplication instance() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return (BlogApplication) Application.get();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Blog getBlog() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return blogService.getBlog();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/blockquote&gt; As you can see, in Wicket 1.2 you no longer need to do &lt;span style=&#034;font-style: italic;&#034;&gt;getPages().setHomePage()&lt;/span&gt; in order to set the main page for your web app. Instead, your &lt;a href=&#034;http://wicket.sourceforge.net/apidocs/wicket/protocol/http/WebApplication.html&#034;&gt;WebApplication&lt;/a&gt; subclass needs to override the &lt;span style=&#034;font-style: italic;&#034;&gt;getHomePage()&lt;/span&gt; method. Also, all the settings should now be set in the &lt;span style=&#034;font-style: italic;&#034;&gt;init()&lt;/span&gt; method. &lt;span style=&#034;font-style: italic;&#034;&gt;ApplicationSettings&lt;/span&gt; no longer exists, and instead has been replaced by specific settings interfaces. A couple of convenience methods were also added, like &lt;span style=&#034;font-style: italic;&#034;&gt;Application.configure()&lt;/span&gt; for direct configuration of an application.&lt;br /&gt; &lt;br /&gt; This is how ViewBlogEntry looks like:&lt;blockquote class=&#034;codeSample&#034;&gt;package org.javageek.wicket;&lt;br /&gt;&lt;br /&gt;import java.text.DateFormat;&lt;br /&gt;&lt;br /&gt;import wicket.PageParameters;&lt;br /&gt;&lt;span style=&#034;font-weight: bold;&#034;&gt;import wicket.RestartResponseException;&lt;/span&gt;&lt;br /&gt;import wicket.markup.html.basic.Label;&lt;br /&gt;import domain.Blog;&lt;br /&gt;import domain.BlogEntry;&lt;br /&gt;&lt;br /&gt;public class ViewBlogEntry extends BasePage {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ViewBlogEntry(PageParameters parameters) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; super();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Blog blog = getBlog();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; BlogEntry entry = blog.getBlogEntry(parameters.getString(&amp;quot;id&amp;quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (null == entry) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&#034;font-weight: bold;&#034;&gt;throw new RestartResponseException(PageNotFound.class);&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; add(new Label(&amp;quot;entryTitle&amp;quot;, entry.getTitle()));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; add(new Label(&amp;quot;entryBody&amp;quot;, entry.getBody()).setEscapeModelStrings(false));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; add(new Label(&amp;quot;pageTitle&amp;quot;, entry.getTitle() + &amp;quot; : &amp;quot; + blog.getName()));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, getBlog().getLocale());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; add(new Label(&amp;quot;entryDate&amp;quot;, df.format(entry.getDate())));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/blockquote&gt;The only difference here from the old example is that instead of invoking a method (&lt;span style=&#034;font-style: italic;&#034;&gt;redirectTo&lt;/span&gt;) to go to the 404 page, I now throw a &lt;a href=&#034;http://wicket.sourceforge.net/apidocs/wicket/RestartResponseException.html&#034;&gt;RestartResponseException&lt;/a&gt;. This seems cleaner, as I&#039;m basically stoping what I&#039;m doing with the exception. I also don&#039;t need to instantiate a page object in 1.2, but send the class reference as the exception parameter.&lt;br /&gt;&lt;br /&gt;The whole migration took me less than an hour, but I wouldn&#039;t use this as a benchmark, as the example is very basic in terms of Wicket functionality. Even though 1.2 breaks a couple of things from 1.1, in my opinion it is a necessary evil in order to put Wicket in a state that makes it even easier to develop things. As before, I&#039;m making the source code &lt;a href=&#034;http://javageek.org/files/wicket-example-1.2.zip&#034;&gt;available&lt;/a&gt;.
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2006/03/14/migrating_wicket_example_to_wicket_1_2_beta_1.html&#034;
    dc:identifier=&#034;http://javageek.org/2006/03/14/migrating_wicket_example_to_wicket_1_2_beta_1.html&#034;
    dc:title=&#034;Migrating wicket-example to Wicket 1.2 (beta 1)&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1142342290495&amp;token=-3064259164178692660&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Wicket</category>
    
    <category>Web</category>
    
    <comments>http://javageek.org/2006/03/14/migrating_wicket_example_to_wicket_1_2_beta_1.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2006/03/14/migrating_wicket_example_to_wicket_1_2_beta_1.html</guid>
    <pubDate>Tue, 14 Mar 2006 13:18:10 GMT</pubDate>
  </item>
  
  <item>
    <title>Comparing Web Frameworks: Wicket</title>
    <link>http://javageek.org/2006/03/08/comparing_web_frameworks_wicket.html</link>
    
      
      
        <description>
          In this article, I introduce the Wicket web framework by using the same comparison requirements as the ones posted by Simon Brown on his Java.net blog.&lt;p&gt;&lt;a href=&#034;http://javageek.org/2006/03/08/comparing_web_frameworks_wicket.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;
        </description>
      
    
    
    
    <category>Wicket</category>
    
    <category>Web</category>
    
    <comments>http://javageek.org/2006/03/08/comparing_web_frameworks_wicket.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2006/03/08/comparing_web_frameworks_wicket.html</guid>
    <pubDate>Wed, 08 Mar 2006 15:28:05 GMT</pubDate>
  </item>
  
  </channel>
</rss>
