Wicket Tabbed Application with Guest Book

I took the "Tabbed Application" sample provided by the NetBeans Wicket plugin and integrated Jeff Schwartz's GuestBook (see yesterday's blog entry for details on that) into it (click to enlarge the images below):

The application now looks like this, i.e., note the new panels package and the TabbedPanelPage class (from the abovementioned sample), which hooks everything together:

Without a doubt the most difficult thing was figuring out how to display static resources, i.e., the image in the first tab. In the end, I set up a specific location for all static resources, i.e., within the 'web' folder:

When you build the project, the 'static' folder is now right at the top (though it could be anywhere, depending on how the 'ignorePaths' parameter is set below):

And then in the web.xml file, take note of the "ignorePaths" parameter:

<filter>
    <filter-name>WicketApplication</filter-name>
    <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
    <init-param>
        <param-name>applicationClassName</param-name>
        <param-value>com.myapp.wicket.Application</param-value>
    </init-param>
    <init-param>
        <param-name>ignorePaths</param-name>
        <param-value>static/</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>WicketApplication</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

That was not fun to figure out. But now I also have a place (static/style.css) for the stylesheet and can load it into all the tabs via the panel that contains them:

Comments:

Geertjan,

Awesome series of posts on Wicket! Thanks for putting these up!

Posted by Jeff Edlund on January 03, 2012 at 03:00 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today