In my .jsp page I have a button that calls a function in the controller. Clicking this button will initiate a download.
<input type=button onClick="location.href='reporting/GroupbasedPreset?rows=24'" value='Last 24 Hours'>
When this is clicked, the controller makes some database calls and comes back with a result. What I want to do is if the result is empty, have a javascript popup appear rather than starting a download. Is there a way to call javascript from within a spring controller?
Basic idea of what I want the controller to do.
int rows = makethedbcall();
if (rows == 0) {
javascript popup;
return;
} else {
continue with download;
}