array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(9) "308660876" ["text"]=> string(45) "安全测试前置实践1-白盒&黑盒扫描" ["intro"]=> string(411) "本文我们将以围绕系统安全质量提升为目标,讲述在安全前置扫描上实践开展过程。希望通过此篇文章,帮助大家更深入、透彻地了解安全测试,能快速开展安全测试。 作者:京东物流 陈维 一、引言 G.J.Myers在《软件测试的艺术》中提出:从心理学角度来说,测试是一个为了寻找错误而运行程序的过程。 " ["username"]=> string(12) "jingdongkeji" ["tagsname"]=> string(39) "前端|安全|黑盒测试|白盒测试" ["tagsid"]=> string(29) "["160","2823","14120","5741"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1681206002" ["_id"]=> string(9) "308660876" } [1]=> array(10) { ["id"]=> string(9) "308660875" ["text"]=> string(24) "vulnhub靶场之ORASI: 1" ["intro"]=> string(256) "准备: 攻击机:虚拟机kali、本机win10。 靶机:Orasi: 1,下载地址:https://download.vulnhub.com/orasi/Orasi.ova,下载后直接vbox打开即可。 知识点:hex编码、ida逆向、AndroidKiller逆向、ffuf爆破、ssti漏洞、s" ["username"]=> string(6) "upfine" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1681204802" ["_id"]=> string(9) "308660875" } [2]=> array(10) { ["id"]=> string(9) "308660874" ["text"]=> string(92) "C# Kafka重置到最新的偏移量,即从指定的Partition订阅消息使用Assign方法" ["intro"]=> string(428) "在使用Kafka的过程中,消费者断掉之后,再次开始消费时,消费者会从断掉时的位置重新开始消费。 场景再现:比如昨天消费者晚上断掉了,今天上午我们会发现kafka消费的数据不是最新的,而是昨天晚上的数据,由于数据量比较多,也不会及时的消费到今天上午的数据,这个时候就需要我们对偏移量进行重置为最新的,以" ["username"]=> string(15) "Poetwithapistol" ["tagsname"]=> string(10) ".NET|Kafka" ["tagsid"]=> string(13) "["300","440"]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1681203303" ["_id"]=> string(9) "308660874" } [3]=> array(10) { ["id"]=> string(9) "308660873" ["text"]=> string(129) "迁移学习()《Attract, Perturb, and Explore: Learning a Feature Alignment Network for Semi-supervised Domain Adaptation》" ["intro"]=> string(194) "论文信息 论文标题:Attract, Perturb, and Explore: Learning a Feature Alignment Network for Semi-supervised Domain Adaptation论文作者:Taekyung Kim论文来源:2020 ECCV论文地" ["username"]=> string(12) "BlairGrowing" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1681203302" ["_id"]=> string(9) "308660873" } [4]=> array(10) { ["id"]=> string(9) "308660872" ["text"]=> string(92) "C# Kafka重置到最新的偏移量,即从指定的Partition订阅消息使用Assign方法" ["intro"]=> string(428) "在使用Kafka的过程中,消费者断掉之后,再次开始消费时,消费者会从断掉时的位置重新开始消费。 场景再现:比如昨天消费者晚上断掉了,今天上午我们会发现kafka消费的数据不是最新的,而是昨天晚上的数据,由于数据量比较多,也不会及时的消费到今天上午的数据,这个时候就需要我们对偏移量进行重置为最新的,以" ["username"]=> string(10) "goodboydcc" ["tagsname"]=> string(10) ".NET|Kafka" ["tagsid"]=> string(13) "["300","440"]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1681202402" ["_id"]=> string(9) "308660872" } [5]=> array(10) { ["id"]=> string(9) "308660870" ["text"]=> string(42) "Django怎么使用原生SQL查询数据库" ["intro"]=> string(392) "这篇文章主要介绍“Django怎么使用原生SQL查询数据库”,在日常操作中,相信很多人在Django怎么使用原生SQL查询数据库问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Django怎么使用原生SQL查询数据库”的疑惑有所帮助!接下来,请跟着小编一起来学习吧! D" ["username"]=> NULL ["tagsname"]=> string(20) "django|sql|数据库" ["tagsid"]=> NULL ["catesname"]=> string(0) "" ["catesid"]=> NULL ["createtime"]=> string(10) "1681201981" ["_id"]=> string(9) "308660870" } [6]=> array(10) { ["id"]=> string(9) "308660871" ["text"]=> string(37) "Express怎么实现定时发送邮件" ["intro"]=> string(432) "今天小编给大家分享一下Express怎么实现定时发送邮件的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。 在开发中我们有时候需要每隔 一段时间发送一次电子邮件,或者在某个特定的时间进行发" ["username"]=> NULL ["tagsname"]=> string(7) "express" ["tagsid"]=> NULL ["catesname"]=> string(0) "" ["catesid"]=> NULL ["createtime"]=> string(10) "1681201981" ["_id"]=> string(9) "308660871" } [7]=> array(10) { ["id"]=> string(9) "308660869" ["text"]=> string(29) "mysql运维------分库分表" ["intro"]=> string(412) "1. 介绍 问题分析: 随着互联网以及移动互联网的发展,应用系统的数据量也是成指数式增长,若采用单数据库进行数据存储,存在以下性能瓶颈: IO瓶颈:热点数据太多,数据库缓存不足,产生大量磁盘IO,效率较低。请求数据太多,带宽不够,网络IO瓶颈。CPU瓶颈:排序、分组、连接查询、聚合统计等SQL会耗费" ["username"]=> string(13) "qds1401744017" ["tagsname"]=> string(5) "mysql" ["tagsid"]=> string(7) "["237"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1681200304" ["_id"]=> string(9) "308660869" } [8]=> array(10) { ["id"]=> string(9) "308660868" ["text"]=> string(41) "ASP.NET Core - 缓存之内存缓存(下)" ["intro"]=> string(292) "话接上篇 [ASP.NET Core - 缓存之内存缓存(上)],所以这里的目录从 2.4 开始。 2.4 MemoryCacheEntryOptions MemoryCacheEntryOptions 是内存缓存配置类,可以通过它配置缓存相关的策略。除了上面讲到的过期时间,我们还能够设置下面这些" ["username"]=> string(6) "wewant" ["tagsname"]=> string(12) "asp.net core" ["tagsid"]=> string(7) "["179"]" ["catesname"]=> string(25) "APS.NET Core 系列总结" ["catesid"]=> string(9) "["15288"]" ["createtime"]=> string(10) "1681200302" ["_id"]=> string(9) "308660868" } [9]=> array(10) { ["id"]=> string(9) "308660867" ["text"]=> string(9) "SPI协议" ["intro"]=> string(334) "SPI协议是由摩托罗拉公司提出的通讯协议(Serial Peripheral Interface),即串行外设接口。广泛用在ADC、LCD等设备与MCU间,要求通讯速率较高的场合。区分它与I2C协议差异以及FLASH存储器与EEPROM存储器的区别。下面我们分别对SPI协议的物理层及协议层进行讲解。" ["username"]=> string(8) "Kaelthas" ["tagsname"]=> string(5) "STM32" ["tagsid"]=> string(8) "["1311"]" ["catesname"]=> string(5) "STM32" ["catesid"]=> string(8) "["1139"]" ["createtime"]=> string(10) "1681199702" ["_id"]=> string(9) "308660867" } } ["count"]=> int(5621682) } [转] jsp:include 和 %@include% 的区别 - 爱码网

首先,转发自yangbobo1992

这个是我见过写的最好的之一

<%@include%>和<jsp:include>的区别,发现了一些东西的。

 

首先说说对这两句话的理解

<%@ include file=""%>
<jsp:include page=""/>
是这两个吧?
共同点:两者都是在请求时包含另一个页面进来!
不同点:
前者:不合适包含动态页面,因为用它包含动态页面时,它并不会去检查所包含文件所发生的变化!所以适应于html页面,不能传任何参数。
后者:合适包含动态页面,它会去定时检查所包含文件的变化,适应用jsp等动态页面,并且可以传参数

我对上面的理解是include指令包含文件就是单纯的文件合并,合并城一个文件jsp文件然后编译成一个文件,这种包含之后被包含的文件如果发生变化,比如在生产环境中替换了一个jsp此时和没有替换是一样的,因为没有再次编译

include动作就不一样了,它会生成各自编译成一个servlet文件(猜测是一个servlet文件),然后通过request和response再把jsp中的内容传给要合如的jsp(即就是编译后的sevlet文件),同样在生产环境中替换了一个被包含的jsp那么当这种变化被检测到时应该就会再合入一次(纯属个人推理)


<%@include%>:页面请求之前预编译,所有代码包含进来之后,一起进行处理,把所有代码合在一起,编译成一个servlet

<jsp:include>:所有代码分别处理,在页面被请求的时候才编译,被编译成多个servlet,页面语法相对独立,处理完成之后再将代码的显示结果(处理结果)组合进来。


JSP中的两种包含页面的方法
第一种:include指令:当JSP转换成Servlet时引入指定文件

<%@ pagecontentType="text/html;charset=GB2312" language="Java"errorPage=""%>
<%@ include file="head.jsp"%>
<%@ include file="body.jsp"%>
<%@ include file="tail.jsp"%>
第二种:<jsp:include>动作元素:当JSP页面被请求时引入指定文件
<%@ page contentType="text/html; charset=GB2312"language="java" errorPage=""%>
<jsp:include page="head.jsp"/>
<jsp:include page="body.jsp"/>
<jsp:include page="tail.jsp"/>
第二种方法可以很方便的用<jsp:param>来向所包含页传递参数,方法如下:
<%@ page contentType="text/html; charset=GB2312"language="java" errorPage=""%>
<jsp:include page="head.jsp"/>
<jsp:includepage="body.jsp">
<jsp:param name="uid"value="username"/>
<jsp:param name="pwd"value="password"/>
</jsp:include>
<jsp:includepage="tail.jsp"/>


<jsp:include> :动态包含

 

第一种情况(<jsp:include>包含的是html文件):

DynamicInclude.jsp:

@pagecontentType""%>
<html>
         <head>
                   <title>动态包含</title>
         </head>
         <bodystyle="background-color:lightblue">
 
                   <jsp:include page="header.html"flush="true"/><!--动态包含-->
 
                   <tableborder="1" align="center">
                            <tr>
                                     <td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>
                            </tr>
                            <tr>
                                     <td>a</td><td>b</td><td>c</td><td>d</td>
                            </tr>
                   </table>
         </body>
</html>

 

Header.html :

<h2style="font-family:arial;color:red;font-size:25px;text-align:center">
         动态包含的标题(HTML)
</h2>

 

运行之后,只生成一个servlet,和上面的代码对应如下:

  out.write("\r\n");
     out.write("<html>\r\n");
     out.write("\t<head>\r\n");
     out.write("\t\t<title>动态包含</title>\r\n");
     out.write("\t</head>\r\n");
     out.write("\t<bodystyle=\"background-color:lightblue\">\r\n");
     out.write("\r\n");
     out.write("\t\t");
     <span style="color:#ff0000;">org.apache.jasper.runtime.JspRuntimeLibrary.include(request,response, "header.html", out, true);</span>
     out.write("<!--动态包含-->\r\n");
     out.write("\r\n");
     out.write("\t\t<table border=\"1\"align=\"center\">\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>a</td><td>b</td><td>c</td><td>d</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t</table>\r\n");
     out.write("\t</body>\r\n");
     out.write("</html>");

 

第二种情况(<jsp:include>包含的是jsp文件):

DynamicInclude.jsp:

@pagecontentType""%>
<html>
         <head>
                   <title>动态包含</title>
         </head>
         <bodystyle="background-color:lightblue">
 
                   <jsp:include page="header.jsp"flush="true"/><!--动态包含-->
 
                   <tableborder="1" align="center">
                            <tr>
                                     <td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>
                            </tr>
                            <tr>
                                     <td>a</td><td>b</td><td>c</td><td>d</td>
                            </tr>
                   </table>
         </body>
</html>

Header.jsp :

@pagecontentType""%>
<html>
         <body>
                   <h2style="font-family:arial;color:red;font-size:25px;text-align:center">
                            动态包含的标题(JSP)
                   </h2>
         </body>
</html>

运行之后,生成了两个servlet:DynamicInclude_jsp.java和header_jsp.java,这也是为什么 Header.jsp中要写上<%@page contentType="text/html;charset=gb2312"%>和完整的<html></html>和<body></body>,而Header.html不用写的原因。因为前者两个.jsp文件是两个相互独立的整体,它们之间的关系是通过request和reponse来发生的,而后者只是简单的嵌套。两个servlet对应的代码如下:


DynamicInclude_jsp.java:

     out.write("\r\n");
     out.write("<html>\r\n");
     out.write("\t<head>\r\n");
     out.write("\t\t<title>动态包含</title>\r\n");
     out.write("\t</head>\r\n");
     out.write("\t<bodystyle=\"background-color:lightblue\">\r\n");
     out.write("\r\n");
     out.write("\t\t");
     <span style="color:#ff0000;">org.apache.jasper.runtime.JspRuntimeLibrary.include(request,response, "header.jsp", out, true);</span>
     out.write("<!--动态包含-->\r\n");
     out.write("\r\n");
     out.write("\t\t<table border=\"1\"align=\"center\">\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>a</td><td>b</td><td>c</td><td>d</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t</table>\r\n");
     out.write("\t</body>\r\n");
     out.write("</html>");

header_jsp.java:    

     out.write("\r\n");
     out.write("<html>\r\n");
     out.write("\t<body>\r\n");
     out.write("\t\t<h2 style=\"font-family:arial;color:red;font-size:25px;text-align:center\">\r\n");
     out.write("\t\t\t动态包含的标题(JSP)\r\n");
     out.write("\t\t</h2>\r\n");
     out.write("\t</body>\r\n");
     out.write("</html>");

 

<%@include%>:静态包含

第一种情况:<%@include%>包含的是jsp文件。

StaticInclude.jsp:

@pagecontentType""%>
<html>
         <head>
                   <title>静态包含</title>
         </head>
         <bodystyle="background-color:lightblue">
 
                   @include file""<!--静态包含-->
                   <tableborder="1" align="center">
                            <tr>
                                     <td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>
                            </tr>
                            <tr>
                                     <td>a</td><td>b</td><td>c</td><td>d</td>
                            </tr>
                   </table>
         </body>
</html>

header.jsp:

@pagecontentType""%>
<h2style="font-family:arial;color:red;font-size:25px;text-align:center">
         静态包含的标题(JSP)
</h2>

 

运行之后,只生成一个servlet,和上面的代码对应如下:

 out.write("\r\n");
     out.write("<html>\r\n");
     out.write("\t<head>\r\n");
     out.write("\t\t<title>静态包含</title>\r\n");
     out.write("\t</head>\r\n");
     out.write("\t<body style=\"background-color:lightblue\">\r\n");
     out.write("\r\n");
     out.write("\t\t");
     out.write("\r\n");
     <span style="color:#ff0000;">out.write("<h2style=\"font-family:arial;color:red;font-size:25px;text-align:center\">\r\n");
     out.write("\t静态包含的标题(JSP)\r\n");
     out.write("</h2>");</span>
     out.write("<!--静态包含-->\r\n");
     out.write("\t\t<table border=\"1\"align=\"center\">\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
      out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>a</td><td>b</td><td>c</td><td>d</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t</table>\r\n");
     out.write("\t</body>\r\n");
     out.write("</html>");

 

第二种情况:<%@include%>包含的是html文件。

StaticInclude.jsp:

@pagecontentType""%>
<html>
         <head>
                   <title>静态包含</title>
         </head>
         <bodystyle="background-color:lightblue">
 
                   @include file""<!--静态包含-->
                   <tableborder="1" align="center">
                            <tr>
                                     <td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>
                            </tr>
                            <tr>
                                     <td>a</td><td>b</td><td>c</td><td>d</td>
                            </tr>
                   </table>
         </body>
</html>

header.html:

@pagecontentType""%>
<h2style="font-family:arial;color:red;font-size:25px;text-align:center">
         静态包含的标题(HTML)
</h2>

运行之后,也是只生成一个servlet,和上面的代码对应如下:

 out.write("\r\n");
     out.write("<html>\r\n");
     out.write("\t<head>\r\n");
     out.write("\t\t<title>静态包含</title>\r\n");
     out.write("\t</head>\r\n");
     out.write("\t<bodystyle=\"background-color:lightblue\">\r\n");
     out.write("\r\n");
     out.write("\t\t");
     out.write("\r\n");
     <span style="color:#ff0000;">out.write("<h2style=\"font-family:arial;color:red;font-size:25px;text-align:center\">\r\n");
     out.write("\t静态包含的标题(HTML)\r\n");
     out.write("</h2>");</span>
     out.write("<!--静态包含-->\r\n");
     out.write("\t\t<table border=\"1\"align=\"center\">\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>姓名</td><td>性别</td><td>年龄</td><td>爱好</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t\t<tr>\r\n");
     out.write("\t\t\t\t<td>a</td><td>b</td><td>c</td><td>d</td>\r\n");
     out.write("\t\t\t</tr>\r\n");
     out.write("\t\t</table>\r\n");
     out.write("\t</body>\r\n");
     out.write("</html>");

 

由上可以总结出:

对于静态包含,<%@include%>,中包含的文件,只是简单的嵌入到主文件中,就是在jsp页面转化成Servlet时才嵌入到主文件中,因为运行的结果是只生成了一个Servlet。

而对于动态包含<jsp:incude>,如果被包含文件是动态的,那 么就会生成两个Servlet,也就是被包含文件也要经过jsp引擎编译执行生成一个Servlet,两个Servlet通过request和 reponse进行通信。如果被包含的文件是静态的,那么这种情况和<%@include>就很相似,只生成了一个Servlet,但是他们 之间没有进行简单的嵌入,而依然是通过request和reponse进行的通信。

相关文章:

  • 2021-11-01
  • 2022-12-23
  • 2021-07-27
  • 2022-02-12
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2021-09-26
相关资源
相似解决方案