You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

What, you want answers too?

This page addresses general FAQ's. More specific FAQ's can be found in the FAQ Category

Table of contents

How do I skip the tests when doing a Maven build?

Add a -Dmaven.test.skip=true parameter to your Maven command line.

Other information about building wicket can be found on the Wicket from source page.

My span tag doesn't get rendered

If a tag's written like this,

<span wicket:id="name"/>

the tag's not rendered, whereas if it's written like this

<span wicket:id="name">name</span>

it is.

The rationale is that we do not automatically convert

<span/>

into

<span></span>

because that's too much "behind-the-scenes" magic for user to be happy with. As a result, as a

<span/>

has no body, onComponentBody() isn't called and nothing is rendered!

What is the meaning of life?

42

How can I change the location of Markup files?

Wicket reads the html template from the same location as the Page class (java class name + ".html"). Can this be changed?

Yes. See Custom resource paths

How can I have images/files uploaded to and downloaded from my wicket app?

In short, use the wicket.markup.html.form.upload.FileUploadField component in your form (set as multiPart) in order to allow file uploads. Use an implementation of the wicket.markup.html.DynamicWebResource to provide downloads of the content. For a longer description with examples see UploadDownload

Is Wicket available in the central Maven 2 repository?

Yes, it is. However, we must rely on the Maven project to update their repository with the latest releases, resulting in some lag. If you need them hot and fresh, you can use the wicket Maven 2 repository by adding the the following to your project's pom.xml:

  <repositories>
    <repository>
      <id>wicket</id>
      <name>Wicket repository</name>
      <url>http://wicket.sourceforge.net/maven2</url>
    </repository>
  </repositories>

How do I add custom error pages (like Page Expired)?

In your application class that extends WebApplication, set the following in the init() method getApplicationSettings().setPageExpiredErrorPage(myExpiredPage.class). There are also some other neat settings you should check out in getApplicationSettings(), getDebugSettings(), getExceptionSettings(), getMarkupSettings(), getPageSettings(), getRequestCycleSettings(), getSecuritySettings and getSessionSettings(). See the javadoc for more information.

My application says "DEVELOPMENT MODE", how do I switch to production?

Add the following to your web.xml inside of <SERVLET>:

<init-param>
            <param-name>configuration</param-name>
            <param-value>DEPLOYMENT</param-value>           
</init-param>

How do I know in what mode (DEVELOPMENT/DEPLOYMENT) my application runs?

if (DEVELOPMENT.equalsIgnoreCase(configurationType))
{
    log.info("You are in DEVELOPMENT mode");
    getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
    getDebugSettings().setComponentUseCheck(true);
    getDebugSettings().setSerializeSessionAttributes(true);
    getMarkupSettings().setStripWicketTags(false);
    getExceptionSettings().setUnexpectedExceptionDisplay(
                    UnexpectedExceptionDisplay.SHOW_EXCEPTION_PAGE);
    getAjaxSettings().setAjaxDebugModeEnabled(true);
}
else if (DEPLOYMENT.equalsIgnoreCase(configurationType))
{
    getResourceSettings().setResourcePollFrequency(null);
    getDebugSettings().setComponentUseCheck(false);
    getDebugSettings().setSerializeSessionAttributes(false);
    getMarkupSettings().setStripWicketTags(true);
    getExceptionSettings().setUnexpectedExceptionDisplay(
                    UnexpectedExceptionDisplay.SHOW_INTERNAL_ERROR_PAGE);
    getAjaxSettings().setAjaxDebugModeEnabled(false);
}

There is no flag telling you in which mode you are. If you want a flag subclass Application.configure() store the "configurationType" parameter in a variable.

I get errors when I use Ajax in Opera Browser (before Version Beta 9 of Opera)

If you want to use wicket's Ajax implementation with Opera Browser you have to do

Application.getApplicationSettings().setStripWicketTags(true);

to get it work.

Because of a Bug which is in all Opera Browsers before Version 9 Beta, the ajax stuff will not work with wicketTags enabled.

Keywords:
Opera Ajax Wicket Strip wicket:id

I get 'Internal error cloning object' errors

This is a debug feature to help find potential problems when the application runs clustered. It checks the component graphs to make sure everything is serializable (which is required for clustering).

If clustering support is not needed, these checks can be disabled by doing getDebugSettings().setSerializeSessionAttributes(false); in the application.init()

Also, if the configuration parameter in the web.xml is set to DEPLOYMENT, these checks are disabled.

Answer provided courtesy Igor Vaynberg

Which browsers have been tested with Wicket AJAX?

To test it use the AJAX examples and the AJAX request header test.

  • Internet Explorer 6
  • Firefox 1.5
  • Firefox 2.0
  • Safari 2.0.1 - 2.0.4
  • Opera 8.54 (linux)
  • Opera 9 (linux)
  • Konqueror 3.5.2 (most of the examples works, but the Todo list example makes the browser crash)

Versioning

Wicket stores versions of pages to support the browser's back button. Because this concept is difficult to understand, we'll present a simple use case that describes the problem and how versioning helps.

Suppose you have a paging ListView with links in the ListItems, and you've clicked through to display the third page of items. On the third page, you click the link to view the details page for that item. Now, the currently available state on the server is that you were on page 3 when you clicked the link. Then you click the browser's back button twice (i.e. back to list page 3, then back to list page 2, but all in the browser). While you're on page 2, the server state is that you're on page 3. Without versioning, clicking on a ListItem link on page 2 would actually take you to the details page for an item on page 3.

(This was taken from an IRC discussion with Martijn.)

How does Wicket know when a new browser window is opened?

Wicket uses the Javascript window.name property to detect if a new window (or tab) was opened. This property is blank by default .

How do I provide the page map for bookmarkable pages?

You do this by providing it as part of the URL. How exactly this looks depends on the 'encoding' of the request. The common cases are:

  • a normal request, where the page map name parameter is provided as a part of the bookmarkable page request parameter:
    myapp?wicket:bookmarkablePage=pageMapName:somepackage.MyPage
  • a request to a mounted URL, where the page map parameter is provided as a path encoded parameter:
    /myapp/mountedpage/param1/value1/wicket:pageMapName/pagemapname
  • No labels