<%@ page language= "java" import= "java.util.*" contenttype= "text/html"; Charset=utf-8 "
%>
<% @page import= "java.text.*"%>
<%
String path = Request.getcontextpath ();
%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>insert title here</title>
<body>
<%!
//returns 99 the HTML code corresponding to the multiplication table, which is called through an expression and displayed on the page. An Out object is an instance of the JspWriter class that is used to output content to the client
String multiplication () {
String s = "";
int i=1,j=1;
For (i=1;i<10;i++) {
For (j=1;j<=i;j++) {
s+=i+ "*" +j+ "=" + (i*j) + " "; / string append, one line as a string
}
s+= "<br>";// line break
}
Return s;// returns a string
}
%>
JSP built-in out object, call using script, print 99 multiplication table
void Multiplication2 (JspWriter out) throws Exception
{
int i=1,j=1;
for (i=1;i<10;i++) {
for (j=1;j<=i;j++) {
OUT.PRINTLN (i+ "*" +j+ "=" + (i*j) + " ");
}
Out.println ("<br>");
}
}
%>
<%=multiplication ()%>// expression method to reference
<% Multiplication2 (out);%>// Script method call, Semicolon end
</body>
99 Multiplication Table-java JSP