Lost parameters during form submission to open a pdf in new window
My java webApp (struts2 and jQuery) has a jsp with a form:
<s:form id="theForm" action="stampaPosizioneFinanziaria" target="_new">
and a jQuery button:
<a id="stampaPerCliente">Stampa standard</a> // rendere by $('#tampaPerCliente').button();
On button click:
$('#stampaPerCliente').click(function(){ avviaStampa(0); });
..开发者_开发百科.
function avviaStampa(tipoStampa) {
$('[name=tipoStampa]').val(tipoStampa); // I set a hidden field
$('#theForm').submit();
// tried document.forms[0].submit(); too, same behavior.
}
So, the new page opened (the form target is _new) calls an action that read the paramters form and displays a pdf. Everything works fine BUT: on IE when I click the button first time it works, second time doesn't, third time does and so on. The 'doesn't work' means the action has every input parameters null! I monitored the request and on IE there aren't request parameters! (even times, not odd times!) It works fine on Chrome and FF.
Help please.
I solved using GET method for submission:
<s:form id="theForm" action="stampaPosizioneFinanziaria" target="_new" method="GET">
The POST method (default for struts2 s:form) caused this issue (?!!!?).
精彩评论