jsp中的include静态包含与动态包含,
d动态包含与静态包含的最大区别是
静态包含:<%@ include file = "文件名.jsp"%>,在<body>的标签外定义。在没有编译的时候,两个java文件都已经包含起来了(合并成一个)。
动态包含:<%jsp:include page= "/文件名.jsp"> <jsp:include>,在<body>标签内定义。在编译之前永远是两个java文件。
静态包含实例代码:先定义一个hel.jsp
<%--
Created by IntelliJ IDEA.
User: sunyubin
Date: 2018/9/11
Time: 下午8:25
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%
String name ="sunyubin";
%>
</body>
</html>
再定义一个lo.jsp文件:
<%--
Created by IntelliJ IDEA.
User: sunyubin
Date: 2018/9/11
Time: 下午8:27
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/hel.jsp" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h1><%=name %><h1/>
</body>
</html>
先运行hel.jsp,再运行lo.jsp。
接下来,再演示一下动态演示过程。
hel.jsp没有变化;
变化的只是lo.jsp
<%--
Created by IntelliJ IDEA.
User: sunyubin
Date: 2018/9/11
Time: 下午8:27
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
html>
<head>
<title>Title</title>
</head>
<body>
<jsp: page include = "/hel.jsp"%> </jsp:> <h1><%=name %><h1/> </body>
</html>
jsp中的include静态包含与动态包含,的更多相关文章
- JSP页面的静态包含和动态包含
JSP中有两种包含:静态包含:<%@include file="被包含页面"%>和动态包含:<jsp:include page="被包含页面" ...
- JSP页面静态包含和动态包含的区别与联系
---恢复内容开始--- JSP页面静态包含和动态包含的区别与联系: 1.<%@ include file=" " %> 是指令元素,<jsp:include p ...
- JSP静态包含和动态包含的区别和联系
JSP页面的静态包含和动态包含 JSP中有两种包含:静态包含:<%@include file="被包含页面"%>和动态包含: <jsp:include page= ...
- JSP静态包含和动态包含
JSP中有两种包含: 静态包含:<%@include file="被包含页面"%>: 动态包含:<jsp:include page="被包含页面&quo ...
- JSP页面的静态包含和动态包含的区别与联系
JSP中有两种包含: 静态包含:<%@include file="被包含页面"%> 动态包含:<jsp:include page="被包含页面" ...
- java web jsp原理图 ,静态包含,动态包含,out与response.getWrite()
jsp原理图 ,静态包含,动态包含,out与response.getWrite()
- linux中C的静态库和动态库分析
从开始学C语言写第一个"hello world"历程到现在,我依然困惑于到底这个程序完整的执行流程是什么样的.不过,现在我正在尝试一点一点的揭开它的面纱.现在,我尝试分析linux ...
- JSP中的include有哪些?有什么差别?
JSP中的include有哪些?有什么差别? 1.JSP中的include有哪些 (1)<%@include file="" %> (2)<jsp:include ...
- JSP中的include有哪些?有什么区别?
JSP中的include有哪些?有什么区别? 1.JSP中的include有哪些 (1)<%@include file="" %> (2)<jsp:include ...
随机推荐
- IOS应用内支付IAP从零开始详解
前言 什么是IAP,即in-app-purchase 这几天一直在搞ios的应用内购,查了很多博客,发现几乎没有一篇博客可以完整的概括出所有的点,为了防止大伙多次查阅资料,所以写了这一篇博客,希望大家 ...
- 笨办法06字符串(string)和文本
代码如下: # coding : utf-8 x = "There are %d types of people." % 10 binary = "binary" ...
- day25 模块04_模块和包
休养生息--模块04 1.导入模块的执行的步骤 2.自定义模块 3.自定义包 一.导入模块的执行步骤 1).判断当前正在导入的模块是否已经导入过 2).如果已经导入过,不会重新导入该模块 3).如果没 ...
- MATLAB图片折腾3
把视频抽帧,转化成图片 我的代码如下,成功实现clc;clear;videofilename='k:\GraduationWork\Resource\video.wmv'; %where you pu ...
- 直接插入排序(Straight Insertion Sort)
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- vue-router-2-动态路由配置
const User = { template: '<div>User{{ $route.params.id }}</div>' } const router = new Vu ...
- x多进程
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' from multiprocessing import Process import os #子进 ...
- [Leetcode 135]糖果分配 Candy
[题目] There are N children standing in a line. Each child is assigned a rating value. You are giving ...
- Centos7搭建软路由
Xenserver环境: 一:环境准备 内网:192.168.2.100 外网:x.x.x.x 1.1:登陆XenCenter 1.2:进入Xenserver中的Networking选项 1.3:点选 ...
- linux 常用重启
sudo reboot 为最常用重启 Linux centos关机与重启命令详解与实战 Linux centos重启命令: 1.reboot 普通重启 2.shutdown -r now 立刻重启(r ...