I have a jsp page in struts 1.2 which has 2 functionalities. Print pdf and submit form.
Print pdf will open a new window and display a pdf generated with the field values in the page.
Submit form should navigate to confirmation page in the same window and save values in db.
Here are the part of code for it.
<a href="javascript:void(0)" onclick="javascript:printPDF();" target="_blank"><img src="/images/buttons/ButtonPrint.gif" border="0" alt="Print" ></a>
<a href="javascript:void(0)" onclick="javascript:submitContinue();"><img src="/images/buttons/ButtonSubmit.gif" border="0" alt="Submit" ></a>
Here are the corresponding javascript methods.
function submitContinue()
{
document.forms[0].action = "/provider/requestSubmitted.do?method=processUpload";
document.forms[0].submit();
return true;
}
function printPDF()
{
document.forms[0].action = "/provider/requestSubmitted.do?method=printPDF";
document.forms[0].target="new";
document.forms[0].submit();
return true;
}
These functionalities works fine separately. But if I click on print and then on submit, the next page(confirmation page) opens in a new tab. It should be in the same window. Please help !!