java include 动态_jsp动态include与静态include区别

在jsp动态include与静态include区别呢,下面我整理了一些网友的经验给各位同学参考一下,希望文章对各位有帮助。

答:动态INCLUDE用jsp:include动作实现

它总是会检查所含文件中的变化,适合用于包含动态页面,并且可以带参数

静态INCLUDE用include伪码实现,定不会检查所含文件的变化,适用于包含静态页面

1. 静态include的结果是把其他jsp引入当前jsp,两者合为一体

动态include的结构是两者独立,直到输出时才合并( 看看jsp生成的java文件就可以知道了)

2.正是因为这样,动态include的jsp文件独立性很强,是一个单独的jsp文件,需要使用的对象,页面设置,都必须有自己创建,当然,还好它和include它的页面的request范围是一致的.

最后看老q外写的

When you use , it executed the target in a separate request, and then includes the output in the including JSP. It doesn’t include the source of the included target, it includes the output. The means by which that target output is generated is lost.

To do what you’re trying to do, you need to use directives:

This will incline the literal text of header.jsp into your page. Of course, by doing that, you can no longer pass parameters to it, so you’d need to set that as a page context attribute (e.g. using … but of course you can’t use until you’ve done your include…).

Essentially, it’s not really worth the hassle. Taglib declarations are annoying boilerplate, but hard to get rid of.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值