版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhou920786312/article/details/82829160
EL表达式
EL表达式用于获取数据,在JSP页面中可使用${标识符}的形式通知JSP引擎调用pageContext.findAttribute()方法,以标识符为关键字从各个域对象中获取对象。如果域对象中不存在标识符所对应的对象,则返回结果为””(注意,不是null)。
<body>
<%
Address address = new Address();
address.setLocation("广州");
address.setZipcode("020123");
Student s = new Student();
s.setName("小华");
s.setAge(20);
s.setSalary(3500);
s.setAddress(address);
session.setAttribute("S",s);
%>
用户名:${S.name}<br/>
年龄:${S.age}<br/>
薪水:${S.salary}<br/>
地址:${S.address.location}<br/>
邮编:${S.address.zipcode}<br/>
<hr/>
10>5->${10>5}
10==5->${10==5}
10<5->${10<5}
</body>