I have a JSP that submits via javascript to a controller.
Everything works fine, but when I try to open the next page on a Popup window,
I noticed that the data on the Form Binding is not submitted to the Controller:
function showDocumentPreview() {
//This is working
//document.getElementById('form').action = "<c:url value='/forms/showDocumentPreview.co' />";
//document.getElementById('form').submit();
//This is NOT working
var url = "<c:url value='/forms/showDocumentPreview.co' />";
window.open (url, "popup","location=0,status=0,scrollbars=1,width=480,height=640");
}
Then in my controller:
@RequestMapping(value = "/forms/showDocumentPreview.co", method = {RequestMethod.GET,RequestMethod.POST })
public ModelAndView showDocumentPreview(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("form") Form form) {
System.out.println(form.getFormName()); //this returns null when I used popup, but it have value when not using popup.
Please kindly help
thank you very much sir/madam
Using
window.open()does NOT submit any form. If you want to open a form in a new window, add_target="_blank"to your form.Example (using JavaScript):