JSP脚本是否是反模式? [英] Are JSP scriptlets an antipattern?

查看:86
本文介绍了JSP脚本是否是反模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望您能理解这个问题.你怎么认为?如果我在这里用scriptlet发布一些代码,我相信您将告诉我不要使用scriptlet.对吧?

I hope you understand the question. What do you think? If I post some code here with scriptlet I'm convinced that you're going to tell me not to use scriptlet whatsoever. Right?

推荐答案

我认为是的,出于几个原因应避免使用它. 起初我真的不喜欢我的代码中的沙拉:) JSP旨在标记事物,而不是表示层中的逻辑. 它只是不可读.

I think yes, it should be avoided for a couple of reasons. At first I really don't appreciate salad in my code :) JSP is intended for marking up the things, not for logic in the representation layer. Its just not readable.

第二,当我开始学习JSP时,我被告知开发JSP的人认为,在理想世界中,真正创建jsp页面的人不应该是Java程序员. 如果您需要通过JSP中的逻辑(条件/循环等)执行某些操作,则Java程序员将更好地在较新的jsp版本中创建标记/标记文件.

At second, when I've started to learn JSP I was told that those who developed JSP thought that in ideal world those who really create jsp pages shouldn't be java programmers. If you need something that should be done by logic in JSP (conditions/loops and so forth) java programmer will better create tags/ tag files in newer jsp versions.

希望这会有所帮助

这篇关于JSP脚本是否是反模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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