JSP和脚本 [英] JSP and scriptlets

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

问题描述

我知道,如今,使用scriptlet被视为禁忌.没关系,我会同意Top Star的话(因为我现在只是Java的新手).

I know that using scriptlets are considered taboo nowadays. Its okay and I will agree to the Top Star's words (as I am just a novice in Java at the moment).

到目前为止,我所听到的是,它使设计师的生活更轻松.但是我想知道,这是否与JSP页面的性能有关.另一方面,如果只是为了使设计师的生活更轻松",那么在Java开发人员完成两项工作的情况下,你们如何使用scriptlet?

What I have heard so far is, its to make the designers life easier. But I wonder, if it has anything to do with performance of JSP pages. On the other hand, if its just for "making designers life easier", what do you guys think about using scriptlets in a situation where Java developer do both the work ?

如果当今的scriptlet在各个方面都不好,那么您有什么建议? EL? JSTL吗?

If scriptlets are bad in all aspects nowadays, what are your recommendations ? EL ? JSTL ?

谢谢

推荐答案

这不仅是要使他人的生活更轻松,还是要使您的生活更轻松. JSTL和其他标签强制/帮助您正确编写JSP. scriptlet的一个问题是人们在JSP中执行不应执行的操作.我的意思是,JSTL(以及其他标签)可以帮助您保持MVC模式,因为基本上,如果在JSP中无法使用JSTL做某些事情,那是因为您不应该这样做.如果您不尊重MVC并在JSP中执行不应该执行的操作

It is not just about making others life easier, it is also about making YOUR life easier. JSTL and other tags force/help you to write a JSP properly. A problem with scriptlets is that people do things in a JSP that they shouldn't. I mean, JSTL (among other tags) helps you to keep MVC pattern because basically, if there is something that you cannot do with JSTL in a JSP, it is because you should not. If you do not respect MVC and do things in JSPs that you shouldn't

您可以使用JSTL,struts标签,springs标签等.选项很少,可以将它们组合在一起.

You can use JSTL, struts tags, springs tags, etc. There are few options and you can combine them.

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

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