The include directive And <jsp:include>

本文对比了JSP中两种不同的文件包含方式:include指令与<jsp:include/>标准操作的区别。前者在翻译阶段将源文件内容插入到当前JSP文件中,而后者则在运行时动态插入文件响应。文中还探讨了它们在性能上的差异及适用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The include directive inserts the SOURCE of JSP or HTML files at [b]translation time[/b].
But the <jsp:include/> standard action inserts the RESPONSE of the JSP or HTML files [b]at runtime[/b].

There is an exra perfermance hit with every <jsp:include>. With directive, on the other hand, the hit happens only once --- when the including page is translated.

So if you're pretty sure that once you go to production the including file won't change, the directive might be the way to go. Of course there's still tradeoff that the generated servlet class is a little larger when you use the directive.

Tip:如果including page是经常改动的,则应该使用 <jsp:include/>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值