In the JSP page below, I am not able to call the function display on button click. How to call this display() service function on button click?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%!
public void display()
{
char myArray[][] = new char[10][10];
System.out.println("<table border=1>");
System.out.println("<tr>");
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
{
if(i%3==0 && j%3==0)
{
myArray[i][j] = 'x';
System.out.println("<td align=center><font color=blue>" + myArray[i][j]+ "</font></td>");
}
else
{
myArray[i][j] = 'p';
System.out.println("<td align=center><font color=blue>" + myArray[i][j]+ "</font></td>");
}
}
System.out.println("</tr>");
}
System.out.println("</table>");
}
%>
<button onClick="display()"> Display </button>
</body>
</html>