在JSP中使scriptlet无效 [英] Making scriptlets invalid in JSPs

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

问题描述

我正在尝试通过在我的部署描述符中编写以下代码来使scriptlet无效 但仍然可以执行scriptlet.

I am trying to make scriptlets invalid by writing the below code in my Deployment descriptor but still the scriptlets are getting executed.

<jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <scripting-invalid>false</scripting-invalid>

            <el-ignored>true</el-ignored>
        </jsp-property-group>
    </jsp-config>

推荐答案

您需要以其他方式对其进行配置.

You need to configure it the other way round.

<scripting-invalid>true</scripting-invalid>
<el-ignored>false</el-ignored>

<scripting-invalid>设置为true时,当仍使用 scriptlets (那些<% %><%= %><%! %>东西)时,容器将引发异常.

When the <scripting-invalid> is set to true, then the container will throw an exception when scriptlets (those <% %>, <%= %> and <%! %> things) are still used.

您绝对不想将<el-ignored>设置为true,否则您将无法使用表达式语言(那些${}东西),这是访问模型和执行函数的推荐方式在JSP中.如果也将其禁用,则所有JSP都将无用,并且可以是纯静态HTML文件.

You definitely don't want to set <el-ignored> to true, otherwise you won't be able to use expression language (those ${} things), which is the recommended way of accessing the model and executing functions in JSPs. If you disable it as well, then all your JSPs would be useless and can be plain static HTML files as good.

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

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