<% 1/在域中存储数据 session . setAttribute (" name ","李四"); request . setAttribute (" name ", "张三"); session . setAttribute ("age ", "23"); %> <h3> el 获取值</h3> ${ requestScope . name } ${ sessionScope . age } ${ sessionScope . haha } ${name } ${ sessionScope . name }
3获取对象、 List 集合、 Map 集合的值 1对象:$[域名称.键名属性名} 本质上会去调用对象的 getter 方法
${ requestScope . u . name }< br > ${ u . age }< br > ${ u . birthday }< br > ${ u . birthday . month }< br > ${ u . birtr }< br >
java代码
private String name ; private int age ; private Date birthday ; public String getBirstr(){ if ( birthday !=nul1){ //1.格式化日期对象 SimpleDateFormat sdf = new SimpleDateFormat ( pattern :"уууу- MM - dd HH : mm : ss "); //2.返回字符串即可 return sdf . format (Ь irthday ); } else { return ""; } 下面的是get set方法