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