I think what you would need to do in this situation is to create a global function that allows you to "breakout" of the dialog (which I am assuming will use an iframe...). So for instance, in your JSP page, you could create a function such like:
FrameBreakout = function(url) {
document.location.href = url;
};
And when you render the response for the login page, do something similar to:
if (parent && parent.FrameBreakout)
{
parent.FrameBreakout("/login.jsp");
}
When that code executes within the iframe (that's why we check for the parent object first) it will cause the outer document to redirect.
That's just a template really, but should lead you in the right direction...