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 7757203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:01:31+00:00 2026-06-01T13:01:31+00:00

Im working on a pay-role system, and once the user refreshes the browser i

  • 0

Im working on a pay-role system, and once the user refreshes the browser i need to refresh the statistics available in that page (the stats should be taken from the DB and display). But right now it doesn’t work properly, cos in page refresh the java code doesn’t get invoked but loads the cached page with the previous data.
I tried fixing it adding the below code but it didn’t work as well.

@Override
protected void setHeaders(WebResponse response) { 
    response.setHeader("Cache-Control",
            "no-cache, max-age=0,must-revalidate, no-store");
}

Anyone knows the fix for this?
Thanks!

This was the initial code

ManageCredits.html

 <wicket:head>
  <wicket:link>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
  </wicket:link>
</wicket:head>
<wicket:panel xmlns:wicket="http://wicket.apache.org/">
        <div class="offercount-container round-border">
        <div class="manage-credits-lbl"><span>Manage Credits</span></div>

                <div>
                <ul>
                     <li>Balance amout:<span wicket:id="balanceAmtLbl" >0</span></li>
                     <li>Number if transactions<span wicket:id="transactionLbl" >0</span></li>
                   </ul>
                </div>
        </div>
</wicket:panel>

ManageCredits.java

    import com.payrole.service.Offer;
import com.payrole.service.OfferService;
import com.payrole.service.ServiceLocator;
import com.payrole.wicket.PayroleLabel;
import java.text.Format;`enter code here`
import org.apache.wicket.markup.html.panel.Panel;

public class OfferFanSummaryPanel extends Panel{      
        private long balance;
        private long transactionCount;

        public OfferFanSummaryPanel(String id){
            super(id);
        }
        public OfferFanSummaryPanel(String id, Offer offer) {
                super(id);
                balance = (client.getBalance()==null) ? 0 : client.getBalance();
                transactionCount = (client.getTransactionCount()==null) ? 0 : client.getTransactionCount();
                initTransactionSummary();              
        }
        private void initTransactionSummary(){
                PayroleLabel balanceAmtLbl = new PayroleLabel("balanceAmtLbl", String.valueOf(balanceAmt), PayroleLabel.NUMBER);
                add(balanceAmtLbl);
                PayroleLabel transactionLbl = new PayroleLabel("transactionLbl", String.valueOf(transaction), PayroleLabel.NUMBER);
                add(transactionLbl);                
        }     
}
  • 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-06-01T13:01:33+00:00Added an answer on June 1, 2026 at 1:01 pm

    You have to use dynamic models. E.g., if you use something like

    add(new Label("name", Model.of(person.getName()));
    

    you will always have the same string displayed: you provide the label with the result of person.getName(). Instead you have to use a model implementation that calculates the value for each render request, for example PropertyModel or AbstractReadOnlyModel with getObject() overridden.

    Wicket creates the components on your page only once and with each request asks the components to render themselves. I guess you code does not get called because it is in the constructor or onInitialze() of the component (page, panel).

    If this is not clear enough, please post some code on what you are doing.

    Edit: As guessed, you are using static Models (models, that have a fixed value, as opposed to models that calculate their value on each render request). I don ‘t see in your code where emailFanCount and openCount come from, but assuming that these get calculated somehow. Try using a PropertyModel on either one of you Objects (client,..) or, add a public String getXXX() {} to you panel and construct your label similar to this:

    Label label = new Label("someID", new PropertyModel(this, "XXX"));
    

    where this is the Panel.

    Have a look in in the Wicket Wiki for an explanation

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

Sidebar

Related Questions

I am currently working a system whereby my users can pay for items that
I am working on a donations page which allows a user to enter a
Im working on a site that currently has multiple H1 tags per page. What
I'm working with Embedly and found out that the key I use, and pay
I have an application I am working on that will need the use of
I'm working on a solution architecture for a new system that will host a
Working on a bunch of forms at the moment and I'm finding that I
Working on a website that has Employee and Branch entities, using a database table
Working on a movie website and would love to find an API that I
Working on a page with multiple sections. at the very top there is a

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.