• 动态包含与静态包含的区别


    当命名了两个相同的局部变量时,使用静态包含会出错!

    例子:

    include.jsp(被包含代码)

    <% 
    int x=4;
    %>
    <h1>include.jsp---<%=x%></h1>


    包含代码:

    <%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
    
    <html>
    	<head>
    		<title>动态包含与静态包含区辨</title>
    		</head>
    	<body>
    		<%
    		int x=44;
    		%>
    		<h3>include_demo4----<%=x%></h3>
    		<jsp:include page="include.jsp"></jsp:include>
    		<h4>如果是静态包含,则两个相同的局部变量X冲突错误,动态包含是先处理后包含的方式,包含的是处理后的结果,故优先使用动态包含!</h4>
    		</body>
    	
    	</html>

    当上段的代码如果使用<%@ include file="include.jsp"%>来包含include.jsp的时候。由于局部变量X而冲突出错!动态包含则没有出错,

    动态包含是先处理后包含的方式,包含的是处理后的结果,故优先使用动态包含!


  • 相关阅读:
    strncat_s
    资源编译器 (.rc) 文件
    C++ Namespace 详解
    Structure Definitions
    SetParent
    C++笔记(1)explicit构造函数
    .def
    tellg()和tellp()
    Data Groups
    Messages
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3249329.html
Copyright © 2020-2023  润新知