I am new to JSP,
I have method that contains loop and want to display value
private void getDemo() {
for(int i=0; i<10; i++) {
setName("Val: " + i); %>
var name = "";
console.log(name);
}%>
String name;
private void setName(String name) {
this.name = name;
}
private String getName() {
return this.name;
}
%>
Call
window.οnlοad=function(){};
Problem
But when I see the console, It only display Val: 9
How can I achieve all value? I need Script code inside Java Code. Is it Possible?
解决方案
Your Javascript runs client side in the browser so will not normally interact with your Java code running server side