进出口工作付费角色系统上,一旦用户刷新浏览器,我需要刷新该页面提供的统计数据(统计资料应当从DB和显示取)。 但现在它不能正常工作,在页面刷新COS Java代码不会被调用,但与以前的数据加载缓存的页面。 我试图修复它添加下面的代码,但它并没有正常工作。
@Override
protected void setHeaders(WebResponse response) {
response.setHeader("Cache-Control",
"no-cache, max-age=0,must-revalidate, no-store");
}
任何人都知道这样做的解决? 谢谢!
这是最初的代码
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);
}
}