Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
borderStylesolid
titleTable of contents
Table of Contents
maxLevel2

Understanding errors

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

Wicket architecture

What about performance and scalability?

...

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

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:
    Code Block
    
    myapp?wicket:bookmarkablePage=myPageMap:somepackage.MyPage
    
  • a request to a mounted URL, where the page map parameter is provided as a path encoded parameter:
    Code Block
    
    /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.

Maven

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

...

There are certain cases when you replace markup in FireFox where some of the nodes are not placed right in the DOM tree. This happens when the markup is invalid, e.g. you have somewhere a block element inside an inline element, such as <table> or <div> in <span>.

How to repaint a (List/Grid/Data/Repeating)View via Ajax?

See How to repaint a ListView via Ajax.

Wicket community

What do you look like?

...

Code Block
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);
}

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

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):

...

Code Block

myapp?wicket:bookmarkablePage=myPageMap:somepackage.MyPage

...


...

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.

How to repaint a (List/Grid/Data/Repeating)View via Ajax?

...