jsp学习之scriptlet的使用方法详解(Jspajax是什么)万万没想到

随心笔谈1年前 (2023)发布 admin
147 0


<html>
<head>
<title>this is java page</title>
</head>
<body>
<!–显示注释 注释内容 –>

<%!
public static final int x=10;

%>
<%!
public int add(int x,int y)
{
return x+y;
}
%>

<%!
class person
{
private String name;
private int age;
public person(String name,int age)
{
this.name=name;
this.age=age;
}

public String toString()
{
return “name=”+name+”,age=”+age;
}

}

%>
<%!
public int li=20;

%>
<%
person p=new person(“test”,10);
out.println(p);
out.println(li);
out.println(add(x,20));
%>
<%
int b=10;
out.println(b);
%>
</body>

</html>

© 版权声明

相关文章