使用scriptlet的缺点? [英] Disadvantages of using scriptlet?

查看:121
本文介绍了使用scriptlet的缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解有关使用Scriplet的全部知识.为什么在编码JSP时不建议这样做.每当我问有关使用scriptlet进行编码时,他们都指向我不要使用它,而应使用JSTL.

解决方案

网络上有几篇文章比较了scrptlet和JSTL(我想您已经在Google上搜索了一些),其中大多数会告诉您相同的内容

  • JSTL更易于测试,维护和阅读
  • JSTL可以重复使用
  • JSTL可以将业务逻辑与表示分离开来
  • JSTL可能会失败而不会破坏整个页面

在另一边

  • JSTL比scriptlet难开发(至少有不同的学习曲线)
  • 要在生产环境中修复scriptlet,只需更改JSP(有时错误会更加明显)

I want to know the whole thing about using scriplet. Why is it not recommended when coding JSP(s). Everytime I ask about coding with scriptlet, they pointing me not to use it and use JSTL instead.

解决方案

There are several articles on the web comparing scrptlets and JSTL (I guess you've googled for some first) and most of them will tell you the same

  • JSTL are easier to test, maintain and read
  • JSTL can be reused
  • JSTL can separate business logic from presentation
  • JSTL can just fail without breaking the whole page

On the other side

  • JSTL is harder to develop than scriptlets (at least there are different learning curves)
  • To fix a scriptlet in production, it's just a matter of changing the JSP (sometimes the error is more evident)

这篇关于使用scriptlet的缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆