当前位置:网站首页>EL与JSTL注意事项汇总
EL与JSTL注意事项汇总
2022-07-05 21:40:00 【全栈程序员站长】
大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。
EL使用表达式(5一个 问题) JSTL使用标签(5问题) 什么是EL。它可以用做? EL全名Expression Language在JSP使用页面 格公式${表达式} 样例${requestScope.customer.id} 功能: 1.才四个域对象中取出属性数据显示
(pageContext.request.session.application)
2.取出请求參数数据显示
<% request.setAttribute(“person”,new Person(“xfzhanag”,18)); %> Map<String,Person> map=new HashMap<String,Person>(); map.put(“A”,new Person(“AA”,12)); map.put(“”B”,new Person(“BB”,13)); map.B.age
{requestScope.person.name}; {requestScope.person[‘name’]}; List里面的第二个数据 <%
<% List list=new ArrayList(); list.add(“a”); list.add(“b”); list.add(“c”); request.setAttribute(“List”,list);
%>
{requestScope.List[1]}; {requestScope.List[‘name’]};
我的年龄:<requestScope.person.name><br/> //什么方便?为什么有个中括号? /* 一种情况? ${requestScope[‘my person’].name}; map.put(“my person”,new Person(“Xxx”,12));
*/ EL能进行的运算? 算数运算(+,-, * ,/ ,%) 关系运算(>,<,==,!=) 逻辑运算(&&,||) empty运算(推断一个数据是否是空) (null,空字符串,空集合)
{empty name}<br>
三目条件运算 {requestScope.person.age>18 ? ‘成年’ : ‘未成年’ }
fmt:formDate SQL标签库 sql http://sun.com/jsp/jstl/sql sql:query xml标签库 xml http://sun.com/jsp/jstl/fmt x:forBach 函数标签库 fn http://sun.com/jsp/jstl/function fn:split 为什么使用JSTL? 在jsp中使用jsp脚本+jsp表达式也能够做循环输出,太麻烦 EL不能做遍历工作 JSTL能做这些并且与jsp和html的标签能够非常好的结合 JSTL高速入门 1.导入JSTL相关的jar包: jstl.jar standard.jar
2.在jsp文件里导入JSTL的c标签库 <%@ taglib uri=”http://java.sun.com/jsp/jstl/core” perfix=”c”
%>
3 <% List<String> list=new ArrayList<String>(); list.add(“A”); list.add(“B”); list.add(“C”); request.setAttribute(“list”,list);
%> <c:forEach items=”
jstl怎样做流程控制? c:if(一重条件推断) c:choose c:when
//需求1:假设我的年龄小于18就输出未成年成(红色字体) <c:if test=”${person.age<18}”> <font color=”red”>未成年人</font> </c:if>
需求2:假设年龄大于60,就输出’老头子‘ 假设年龄小于18,就输出”小屁孩” 其它。就输出”成年人” <br/> <c:choose> <c:when test=”${person.age>60}”>老头子
</c:when> <c:when test=”${person.age<18}”>小屁孩
</c:when> <c:otherwise>成年人</c:otherwise> </c:choose> jstl怎样做遍历? <% Map<String,Person> map=new
HashMap<String,Person>(); map.put(“1”,new Person(“AA”,23)); map.put(“2”,new Person(“BB”,23)); map.put(“3”,new Person(“CC”,23)); map.put(“4”,new Person(“DD”,23)); map.put(“5”,new Person(“EE”,23)); map.put(“6”,new Person(“FF”,23)); request.setAttribute(“personMap”,map); %> <h3>将数据用表格显示出来</h3> <table border=”1″ style=”width:300px”> <tr> <td>ID</td> <td>姓名</td> <td>年龄</td> </tr> <c:forEach items=”{item.key}</td> <td>
版权声明:本文博客原创文章,博客,未经同意,不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/117575.html原文链接:https://javaforall.cn
边栏推荐
- Pytoch practice -- MNIST dataset handwritten digit recognition
- R language [data management]
- 总结出现2xx、3xx、4xx、5xx状态码的原因
- SQL common syntax records
- Oracle HugePages没有被使用导致服务器很卡的解决方法
- Simple interest mode - lazy type
- 力扣------经营摩天轮的最大利润
- postgres 建立连接并删除记录
- Add ICO icon to clion MinGW compiled EXE file
- Recursive query of multi-level menu data
猜你喜欢

Oracle检查点队列–实例崩溃恢复原理剖析

Yolov5 training custom data set (pycharm ultra detailed version)

MySQL 千万数据量深分页优化, 拒绝线上故障!

Display DIN 4102-1 Class B1 fire test requirements
![R language [data management]](/img/41/b89bb8794c06280e58988e1c1a5e02.png)
R language [data management]

2022-07-03-CKA-粉丝反馈最新情况

从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析

matlab绘制hsv色轮图

2022-07-03-cka- latest feedback from fans

Clickhouse copy paste multi line SQL statement error
随机推荐
Get JS of the previous day (timestamp conversion)
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
GCC9.5离线安装
Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"
PIP install beatifulsoup4 installation failed
JS common method encapsulation
Four components of logger
Emotional analysis of wechat chat records on Valentine's day based on Text Mining
[case] Application of element display and hiding -- element mask
秋招将临 如何准备算法面试、回答算法面试题
办公遇到的问题--
Aitm2-0002 12s or 60s vertical combustion test
Environment configuration problem record
Dictionary tree simple introductory question (actually blue question?)
思特奇加入openGauss开源社区,共同推动数据库产业生态发展
力扣------经营摩天轮的最大利润
初级软件测试必问面试题
Simple interest mode - evil Chinese style
KingbaseES V8R3集群维护案例之---在线添加备库管理节点
Kingbasees v8r3 data security case - audit record clearing case