Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7248365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:07:42+00:00 2026-05-28T22:07:42+00:00

Assume following component tree: A B C A has a private field (called filter)

  • 0

Assume following component tree:

  • A
    • B
    • C

A has a private field (called filter) and the reference to the filter is passed on to B and C.
In class B a property of the filter is modified through an AjaxLink (so no page refresh).
I see (through) logging that after each ajax call wicket will serialize A, B and C.

Now, everything works fine, clicking in the AjaxLinks in B will nicely update the filter and will refresh C and show the correct information in C (based on the filter).

However, assume if click an AjaxLink in B which will update a property of the filter to (for instance) value 2. Afterwards I press F5, it still works and the page (and all components in it) is deserialized (and again serialized afterwards). I then click on an AjaxLink the changes the value of the mentioned property to 3; this still works fine. If, however, I then do a page refresh (F5) the value of that property suddenly becomes 2 again.

It seems that on the page refresh (when wicket will load the page from disk) wicket is deserializing an older version of the filter.

Schematically:

  1. Page initial load:
    => filter.value = 3 -> serialized
  2. AjaxLink:
    => filter.value = 2 -> serialized
  3. Page refresh:
    => filter.value = 2 -> deserialized/serialized
  4. AjaxLink:
    => filter.value = 3 -> serialized
  5. Page refresh:
    => filter.value = 2 -> deserialized/serialized

It seems that on action 5 the serialized version after action 4 is ignored and the serialized version after action 3 the loaded.

Hoping for a cause, explanation and if possible also the solution 🙂

CODE

public class A extends Panel { //creates the filter and passes the reference on 
        Filter filter = new Filter(TypeEnum.ALL);

    public A(final String id) {
        super(id);

    add(new B("filterPanel", filter));
    add(new C("datatable", filter));
}



    public class B extends Panel { //updates the filter

        Filter filter;;
        public B(final String id, Filter filter) {
            super(id);
            this.filter = filter;
            add(new IndicatingAjaxLink<Void>("other") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                filter.setType(TypeEnum.OTHER);
                            ...
            }
        };
        }

    }

public class C extends Panel { //uses the filter

    Filter filter;;
    public C(final String id, Filter filter) {
            super(id);
            this.filter = filter;
    }

    public void populateRepeatingView() {
         final List<? extends WallEntry> result = service.find(filter);
         ...
    }    
}

Code has been simplified and I retained only the (I assume) pertinent stuff.

UPDATE

If I add following in my page class then it works:

@Override
public boolean isVersioned() {
    return false;
}

Not sure however about the implications of this and why this makes it work. Isn’t the page (de)serialized anymore?

UPDATE

I added following to my Page class:

private void writeObject(ObjectOutputStream oos) throws IOException { 
oos.defaultWriteObject(); 
System.err.println("Writing " + this + something to print out the type of the filter); 
} 

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { 
ois.defaultReadObject(); 
System.err.println("Reading " + this + something to print out the type of the filter); 
} 
  1. When the Page is loaded first it prints (actually it prints this 5 times, not sure if it’s normal):
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 0, render count = 1]: type = ALL

  2. When I click on AjaxLink ‘ALL’ (that will update the filter) it still prints:
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 0, render count = 1]: type = ALL

  3. When I click on AjaxLink ‘DISCUSSIONS’ (that will update the filter) it still prints:
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 0, render count = 1]: type = DISCUSSIONS

  4. When I refresh the page (F5) the pageid is updated:
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 1, render count = 2]: type = DISCUSSIONS

  5. When I click on AjaxLink ‘ALL’ (that will update the filter) it prints:
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 1, render count = 1]: type = ALL

  6. So far so good but when I refresh the page now (F5) this is printed out:
    Reading [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 0, render count = 1]: type = DISCUSSIONS
    Writing [Page class = com.bnpp.ecom.homepage.web.Homepage, id = 2, render count = 2]: type = DISCUSSIONS

The url never changes, it stays http://…/?0

So it deserializes the page with id 0 although the last known page id was 1 and all changes that were done for version 1 are ignored (in this case switching the type from DISCUSSIONS to ALL).

Created a issue in the wicket jira for this: https://issues.apache.org/jira/browse/WICKET-4360

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:07:43+00:00Added an answer on May 28, 2026 at 10:07 pm

    As mentioned in the jira issue: https://issues.apache.org/jira/browse/WICKET-4360 you need to setreuseitems on listviews to true or an ajax call will dirty your page when the listview is repopulated:

    On F5 Wicket reads (once) the current page. But then it writes a the
    page with a new page id because of the usage of ListView
    (PropertyListView in DataPanel). By adding
    “commentsListView.setReuseItems(true);” all is fine. See WICKET-4286
    for a discussion about the ListView problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume the following class: public class MyEnum: IEnumerator { private List<SomeObject> _myList = new
Assume the following: we have class B, which is a private class nested inside
Lets assume following classes definition: public class A { public final static String SOME_VALUE;
Assume the following: models.py class Entry(models.Model): title = models.CharField(max_length=50) slug = models.CharField(max_length=50, unique=True) body
Assume the following type definitions: public interface IFoo<T> : IBar<T> {} public class Foo<T>
Assume the following layout: <span class=container> <video class=video> <source ... /> </video> <div class=controls>
Assume the following toy class, and modern compilers (recent gcc for example). template <typename
Assume the following entity classes: public class Player { public virtual int ID {
Let's say I have 5 separate assemblies with the following (assume the class name
Assume the following code: using (SqlConnection conn = new SqlConnection(connectionString)) { ... using (SqlCommand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.