问题
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?
回答1:
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.
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.
Hope this helps
回答2:
No , but understanding will be tough and there is no performance related problem
Check this article for more information: Scriptless JSP Pages: The Front Man
回答3:
No logic in JSP. Just plain working with beans. :) So IMO scriplets wouldn't be a good solution. UI must be UI, but not something very heavy.
来源:https://stackoverflow.com/questions/13081818/are-jsp-scriptlets-an-antipattern