我有一个jsp,其提交按钮如下:
<s:submit style="color: white;background-color: #32CD32" value="%{#forceOk}"
onclick=" return forcePayment(%{#hStatus.index});" />
javascript如下:
function forcePayment(index) {
var message=document.getElementById('popUp').value;
var errorMessage=document.getElementById('popUpErrorMessage').value;
var popUpValue = prompt(message);
if(popUpValue === null || popUpValue == "") {
alert(errorMessage);
return false;
}
else if (popUpValue != null) {
var id1='key'+index;
var key=document.getElementById(id1).value;
var paymentStatus=document.getElementById('stat').value;
var recurringId=document.getElementById('recurringId').value;
var url='recurring_paymentDetails.action?recurringId='+recurringId+'&actionValue='+popUpValue+'&dateKey='+key+'&paymentStatus='+paymentStatus;
document.getElementById('recurringPaymentDetails').action = url;
return true;
}
}
表单如下:
<s:form name="recurringPaymentDetails" id="recurringPaymentDetails" theme="simple">
问题在于,一旦提交表单,数据便会传递到action方法,并且数据库中的值会更新,而jsp不会使用最新值进行更新。
如何使用更新后的值刷新页面?我尝试了Ajax和其他方法,但没有成功!