標籤:jsp指令 requests htm 筆記 file 其他 index.jsp remove 代碼
JSP1)Java Server Page,在html中嵌入java代碼2)九個內建(隱式)對象requestresponseoutpagepageContextconfigsessionapplicationException3)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" %>JSTL1)JSP Standard Tag Libarayhttp://www.runoob.com/jsp/jsp-jstl.html2)四類標籤核心(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是每一項EL1)Expression Languagehttp://www.runoob.com/jsp/jsp-expression-language.html2)十一個內建(隱式)對象pageScoperequestScopesessionScopeapplicationScopeparamparamValuesheaderheaderValuesinitParamcookiepageContext
JSP、JSTL、EF學習筆記