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

Compare with Current View Page History

« Previous Version 25 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 do you look like?

You can see some of the Wicket committers in action at the Wicket gathering in 2005 in Deventer, Holland. You'll see Eelco, Johan, Juergen, Martijn and Jonathan, and emeritus committer Chris.

What is the meaning of life, the universe and everything?

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-stuff's Maven 2 repository by adding the the following to your project's pom.xml:

<repositories>
    <repository>
      <id>org.wicketstuff</id>
      <name>Wicket Stuff Repo</name>
      <url>http://wicketstuff.org/maven/repository</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 (myPageMap is the page map):

  • a normal request, where the page map name parameter is provided as a part of the bookmarkable page request parameter:
    myapp?wicket:bookmarkablePage=myPageMap: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/myPageMap
    

What is the future of onAttach and onDetach methods?

Igor Vaynberg in wicket-dev:

We are trying to consolidate the methods. We have a bunch of
internalOnAttach/internalAttach/attach/onattach methods. it's a big mess.
what this refactor does is give you one method you can override - onattach()
but forces the call to super.

Doing it like it has been done doesn't work. users assume onattach() is a
template method, they can override and not have to call super - but this
fails if you go more then one method deep!

if i create a custom component and do something in onattach(), then the user
subclasses it and they do something in onattach() and don't bother to call
super() they will break my functionality. My only choice of action is to
make onattach() final in my custom component and provide yet another
template for the user, onattach2() ? This just doesn't scale. Better to have
a simple and clear contract - onattach and ondetach always require the call
to super.

Unfortunately the only way to do that at this point and keep the same
method names is to do what i did.

OT there is a JSR for software defect annotations that includes something
like @MustCallSuper (forget what its called), that combined with an apt
builder in an ide will make these kinds of contracts very easy to enforce at
compile time. we are just not there just yet.

How can I use wicket to develop webapps that target mobile devices?

Write clean HTML with CSS targeted toward the various mobile clients that you wish to support. More info can be found on the Mobile Devices page.

What about performance and scalability?

Wicket performance is actually quite good under stress. Remember though that in many real-world application your bottleneck will be in business or database layer.

Wicket benchmark can be found here: wicket-1.x-benchmark.

You should also search wicket-user mailing list for performance and scalability or simply use performance-scalability-tipsas your starting point.

  • No labels