I am attempting to call a java class function inside javascript that is inside a jsp page. I've imported it...
<%@ page language="java" import="myPackage.*"%>
I've constructed the class
<%
myClass myJavaInstance =new myClass();
System.out.println("this worked!");
%>
I have a bit of javaScript with an alert message in it
<script>
alert("hello ");
</script>
But when I add this line...
var thisHere = <%= myJavaInstance.getName() %>
before the alert it doesn't show up
<script>
var thisHere = <%= myJavaInstance.getName() %>
alert("hello ");
</script>
If I put it after the alert it shows up
<script>
alert("hello ");
var thisHere = <%= myJavaInstance.getName() %>
</script>
I know the method gets called because I put a println in it. What am I missing here? It should work right?