码迷,mamicode.com
首页 > Web开发 > 详细

JSP、JSTL、EF学习笔记

时间:2017-07-23 22:57:19      阅读:358      评论:0      收藏:0      [点我收藏+]

标签:jsp指令   requests   htm   笔记   file   其他   index.jsp   remove   代码   

JSP
1)Java Server Page,在html中嵌入java代码
2)九个内置(隐式)对象
	request
	response
	out
	page
	pageContext
	config
	session
	application
	Exception
3)JSP指令
	<%@ page ... %>		Page指令,定义页面属性
		eg:<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
	<%@ include ... %>	包含其他文件
		eg:<%@ include file="../common/comm.jsp"%>
	<%@ taglib ... %>	引入标签库的定义
		eg:<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

JSTL
1)JSP Standard Tag Libaray
	http://www.runoob.com/jsp/jsp-jstl.html
2)四类标签
	核心(core)标签
	格式化(format)标签
	SQL标签
	XML标签
3)标签的使用(以核心标签为例)
	a.在web.xml中配置
		<jsp-config>
			<taglib>
				<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
				<taglib-location>/WEB-INF/taglib/c.tld</taglib-location>
			</taglib>
		</jsp-config>
	b.在jsp页面中添加
		<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
4)核心标签
	<c:out ></c:out>
	<c:set var="" value="" scope=""/>
		scope可选,默认为page
	<c:remove var="" scope=""/>
		同set
	<c:url value="/index.jsp"/>
		会自动在value前添加项目名,即project_name/index.jsp,亦等同于${pageContext.request.contextPath}/inedx.jsp的效果
	<c:if test="${condition}" val="" scope="">
		do something...
	</c:if>
	<c:choose>
		<c:when test="${condition}">
			do something...
		</d:when>
		<c:when test="${condition}">
			do something...
		</d:when>
		<c:when test="${condition}">
			do something...
		</d:when>
		<c:otherwise test="${condition}">
			do something...
		</d:otherwise>
	</c:choose>
	<c: forEach val="" items="">
		do something...
	</c:forEach>
		items为传入的集合,val是每一项

EL
1)Expression Language
	http://www.runoob.com/jsp/jsp-expression-language.html
2)十一个内置(隐式)对象
	pageScope
	requestScope
	sessionScope
	applicationScope
	param
	paramValues
	header
	headerValues
	initParam
	cookie
	pageContext

JSP、JSTL、EF学习笔记

标签:jsp指令   requests   htm   笔记   file   其他   index.jsp   remove   代码   

原文地址:http://www.cnblogs.com/stonesingsong/p/7226156.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!