jsp的声明脚本

1.格式<%! %>                   就是定义  定义代码的
可以给jsp翻译出来的java类定义属性和方法甚至代码块
定义属性 静态代码块 方法 都可以
<%!
private Integer id;
private String name;
private static Map<String,Integer> map;

%>
<%!
static {map=new HashMap<>();
map.put("1",1);
}
%>
<%!
public int x(){return 1;}
%>

<%!
public static class A{
private Integer id;
}
%>

猜你喜欢

转载自www.cnblogs.com/whydbk/p/13371861.html