这是主页
Button btn = new Button("测试导包");
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
out.println( sdf.format(d) );
//JSP中的局部变量---在底层函数 _jspService()内都有效
String str="湖南城院";
//pageContext.setAttribute("name", "page1111");
//request.setAttribute("name", "req22222");
//session.setAttribute("name", "session33333");
application.setAttribute("name", "app44444");
%>
String hello(){
return "hello";
}
%>
随便输出点信息...
out.println(str); //访问局部变量
out.println( hello() );//访问类成员
//exception.getStackTrace(); //使用exception,必须在Page指令中添加属性:isErrorPage="true"
String res = (String) pageContext.findAttribute("name");//依次从:pageContext,request,session,applicat这4个从小到大的容器中去读取属性
out.println(res);
String res2 = (String) pageContext.findAttribute("name2");//若4个容器中都没有该属性,则输出:null
out.println(res2);//null
%>
ooooo:${name}
kkkkk:${name2}
//以下用于测试erroPage属性
int i = 100/0;
%>