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输出简单的运 ...
随机推荐
- node入门 express ejs
hello.js var express = require("express"); var app = express(); app.get("/hello" ...
- Rectangle(csu)
Description Now ,there are some rectangles. The area of these rectangles is 1* x or 2 * x ,and now y ...
- HTML DOM Document
Document 对象 每个载入浏览器的 HTML 文档都会成为 Document 对象. Document 对象使我们可以从脚本中对 HTML 页面中的所有元素进行访问. 提示:Document 对 ...
- 解决(空密码的root)提示修改phpmyadmin用户密码
打开 phpmyadmin数据表,点击权限 如果没有,请参考:http://jingyan.baidu.com/article/636f38bb293a9bd6b846100d.html 创建 在 ...
- UVa1486 Transportation(最小费用最大流)
题目大概说有n个城市,m条有向边连着它们,每条边都有两个属性一个是ai一个是ci,ai表示运送x单位货物时花费ai*x*x的价钱,ci表示边最多能运送的货物数量(<=5).问从城市1运送k单位货 ...
- leetcode Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using ext ...
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法 添加一行 manager. ...
- jQuery AJAX实例
<html><head><title>jQuery Ajax 实例演示</title></head><script language= ...
- MongoDB 用户配置
====[安装]====DOS下切换到文件所在盘符 例如 D:\MongoDB\bin设置数据库保存位置 mongod.exe --dbpath D:\MongoDB\Data [--auth]//用 ...
- springmvc入门基础之注解和参数传递
一.SpringMVC注解入门 1. 创建web项目2. 在springmvc的配置文件中指定注解驱动,配置扫描器 <!-- mvc的注解驱动 --> <mvc:annotation ...