<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
jsp语法结构:
page为jsp指令
language jsp中的代码写什么语言
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
1. <%写java代码%>
2.9大隐式对象,request为其中之一
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
taglib为标签,jsp支持标签技术,使用标签功能能够实现视图代码重用,很少量的代码就能实现很复杂的显示效果。要使用标签功能,要先声明标签库库以及标签前缀 。uri为类库的地址,prefix为标签的前缀。
<jsp:include page="head.jsp"></jsp:include>
动态包含
<c:if test="${dt.dtype==1 }">
<p class="MsoNormal"
style="margin-left: 0cm; text-indent: 0cm;">${dt.dname }:${dt.dcontent }
</p>
</c:if>
1. ${dt.dtype}是EL表达式
2. <c:if></c:if>是标签
网友评论