My code currently looks like this
<%
if (request != null) {
bustOut;
}
%>
<script language="javascript">
function bustOut(){
var newWin = window.open("the real url", "subWindow","height=500,width=700,resizable=yes,scrollbars=yes");
}
</script>
How do I call the javascript function inside the Java code? Or is that not possible?
JSP runs at webserver and generates/produces HTML/CSS/JS code upon a webbrowser request. Webserver sends HTML/CSS/JS to webbrowser. Webbrowser runs HTML/CSS/JS. So, you just have to let JSP print it literally as JS code.
or, better, with EL
(note that I changed the attribute name to
foobecauserequeststands forHttpServletRequestwhich might confuse others since this is nevernull)Either way, the generated HTML (which you should see by opening page in browser, rightclicking it and choosing View Source) should look like this when the condition was true:
Does it now turn on a light bulb above your head?