JSTL简介及安装

本章目标
了解JSTL的主要作用;
在项目中安装并配置JSTL。

 

JSTL简介
JSTL(JSP Standard Tag Library,JSP标准标签库)是一个开放源代码的标签组件,由Apache的Jakarta小组开发,可以直接从http://tomcat.apache.org/taglibs/下载

 

JSTL主要的标签分类

 

安装JSTL 1.2
下载来的JSTL.是以jar包的形式存在的,直接将此Jar包保存在WEB-INF/lib目录之中,之后可以直接通过WINRAR工具打开此JAR包,并且将里面的META-INF文件夹中的几个主要标签配置文件:c.tld、fmt.tld、fn.tld、sql.tld、x.tld保存在WEB-INF文件夹之中

 

简单的JSTL程序

<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>第1个JSTL程序</title>
</head>
<body>
	<h3><c:out value="Hello World!!!"></c:out></h3>
</body>
</html>

效果图:

 

我的是MyEclipse 10软件,不需要自己手工配置,就可以直接使用。

 

配置web.xml
<jsp-config>
  <taglib>
  <taglib-uri>http://www.baidu.cn/jstl/core</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>http://www.baidu.cn/jstl/fmt</taglib-uri>
  <taglib-location>/WEB-INF/fmt.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>http://www.baidu.cn/jstl/fn</taglib-uri>
  <taglib-location>/WEB-INF/fn.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>http://www.baidu.cn/jstl/sql</taglib-uri>
  <taglib-location>/WEB-INF/sql.tld</taglib-location>
  </taglib>
  <taglib>
  <taglib-uri>http://www.baidu.cn/jstl/x</taglib-uri>
  <taglib-location>/WEB-INF/x.tld</taglib-location>
  </taglib>
</jsp-config>

 

小结
JSTL是一个第三方的开源标签库;
JSTL操作时需要自己手工配置,如果通过MyEclipse开发,则可以直接使用。

 


 


 

 

 

 

 

 

 

 

 


 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值