I am developing a web project using spring mvc and dojo. I have a unique problem. This is what I am doing :
- Submit a form to the controller and generate a pdf in the controller. Set the pdf in the response
- The target of the form is an iframe so that the pdf shows in the form after submit.
This works perfect.
Now, my problem is :
I am doing validations on the form using spring mvc validator and if there is an error I must return to the same page with the error message(s).
The problem is to combine these two approaches. If I find an error and return with the return view, since the target of the form is the iframe, the response gets shown in the iframe which obviously I don't want (I want to show the new page) and if everything is good, I must set the pdf in the response and show it in the iframe using the target. How can I achieve this?