JSP Standard Tag Library JSP标准标签库
了解了基本的标签的底层实现,可以看系统定义的强大的标准标签
1、首先引入两个jar包
2、基本语法
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:out value="你好" ></c:out>
核心标签库
c:out
c:set
c:remove
c:catch
c:if
c:choose c:when c:otherwise
c:forEach
c:fortokens
c:import
c:url
c:redirect
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>c_out</title>
</head>
<body>
<%-- c:out --%>
<%
pageContext.setAttribute("userName","lisaRong");
%>
<c:out value="${userName }" ></c:out><br>
<c:out value="${userName2 }" default="某人" ></c:out><br> <%-- c:set --%>
<c:set var="people" value="james" scope="request"></c:set>
<c:out value="${people }" ></c:out><br> <jsp:useBean id="per" class="com.zhiqi.model.Person" scope="page"></jsp:useBean>
<c:set property="id" target="${per }" value="10010"></c:set>
<c:set property="name" target="${per }" value="丽丽"></c:set>
<c:set property="age" target="${per }" value="24"></c:set>
<p>${per.id }</p>
<p>${per.name }</p>
<p>${per.age }</p> <c:remove var="people" scope="request"></c:remove>
<c:out value="${people }" default="没人么?"></c:out><br> <%--异常捕获 --%>
<c:catch var="errorMsg">
<%
int a=1/0;
%>
</c:catch>
<p>${errorMsg }</p> <c:if test="${per.age>18 }" var="r" scope="page">
<p>年龄:${per.age }</p>
</c:if> <c:set property="age" target="${per }" value="16"></c:set>
<c:if test="${per.age<18 }" var="result" scope="page">
<p>未成年</p>
</c:if>
</body>
</html>
JSP Standard Tag Library JSP标准标签库的更多相关文章
- JSTL的全称:JSP Standard Tag Library, jsp 标准标签库
JSTL的全称:JSP Standard Tag Library, jsp 标准标签库 JSTL的作用 提供给Java web开发人员一个标准通过的标签函数库和EL来取代传统直接在页面上嵌入j ...
- JSTL(JSP Standard Tag Library ,JSP标准标签库)
JSTL标签之核心标签 JSTL(JSP Standard Tag Library ,JSP标准标签库)是一个实现 Web应用程序中常见的通用功能的定制标记库集,这些功能包括迭代和条件判断.数据管 ...
- 自定义标签 与 JSTL(JSP Standard Tag Library)
1.自定义标签 [理解] [1]简介 > 在JSP2.0以后,在jsp页面中不建议使用脚本片段<% %>和JSP表达式<%= %> ...
- JSP 标准标签库(JSTL)(JSP Standard Tag Library)
[1] JSTL简介 > JSTL是JSP的标准标签库 > JSTL为我们提供了一些常用的标签,供我们日常开发使用(if . if...else .遍历 . 日期格式化) ...
- javaEE(7)_自定义标签&JSTL标签(JSP Standard Tag Library)
一.自定义标签简介 1.自定义标签主要用于移除Jsp页面中的java代码,jsp禁止出现一行java脚本. 2.使用自定义标签移除jsp页面中的java代码,只需要完成以下两个步骤: •编写一个实现T ...
- EL(Expression Language)和JSTL标签(JSP Standard Tag Library)
一.EL表达式: Expression Language提供了在 JSP 脚本编制元素范围外(例如:脚本标签)使用运行时表达式的功能.脚本编制元素是指页面中能够用于在JSP 文件中嵌入 Java代码的 ...
- JSTL(JSP Standard Tag Library)读书笔记
分类 Preifx 范例 核心标签库--- ...
- 标准标签库JSTL(JSP Standard Tag Library)
1, 核心标签(最常用, 最重要的) 表达式控制标签 out 输出常量 value---直接赋值 输出变量 default---默认值 escapeXml---控制转义字符(默认为true, 如果需要 ...
- EL表达式,JSTL:jsp standard Tag Library
1.EL表达式的作用: 1.1访问Bean的属性. 方式一:${对象名 . 属性名} eg:${user.name} 方式二:${对象名["属性名"]} 1.2输出简单的运 ...
随机推荐
- java synchronized修饰普通方法,修饰静态方法,修饰代码块,修饰线程run方法 比较
synchronized用于多线程设计,有了synchronized关键字,多线程程序的运行结果将变得可以控制.synchronized关键字用于保护共享数据. synchronized实现同步的机制 ...
- wordpress发送测试邮件
下面的邮箱设置使用了qq邮箱的设置 写上接收测试邮件的邮箱 再send test
- ural 1073. Square Country
1073. Square Country Time limit: 1.0 secondMemory limit: 64 MB There live square people in a square ...
- curl/wget 测试http请求的响应头信息
1. wget –debug wget可以使用debug信息来查看信息头,如下: [root@localhost ~]# wget --debug http://192.168.1.101:8080/ ...
- ACM: The Suspects-并查集-解题报告
The Suspects Time Limit:1000MS Memory Limit:20000KB 64bit IO Format:%lld & %llu Description 严重急性 ...
- [杂谈] My Wikipedia
// 此博文为迁移而来,写于2015年6月8日,不代表本人现在的观点与看法.原始地址:http://blog.sina.com.cn/s/blog_6022c4720102w3de.html
- [备份]Emacs配置文件
(set-background-color "gray20")(set-foreground-color "wheat") (tool-bar-mode -1) ...
- 【POJ】1284 Primitive Roots
http://poj.org/problem?id=1284 题意:求一个素数p的原根个数.(p<=65535) #include <cstdio> #include <cst ...
- [BZOJ2797][Poi2012]Squarks
2797: [Poi2012]Squarks Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 211 Solved: 89[Submit][Status ...
- Codeforces Beta Round #2
A题,神题意题.. #include <iostream> #include <cstdio> #include <cstring> #include <st ...