c:out和使用$打印输出之间的区别 [英] Difference between c:out and print the output using $
问题描述
在JSTL中有两种打印输出的方法 -
In JSTL there are two ways to print the output -
< H1>< c:out value =$ {theOutput }/>< / H1>
AND
< H1> $ {theOutput}< / H1>
有什么区别?哪一个是首选方式?
What is the difference? And which one is preferred way?
谢谢。
推荐答案
两者方法 c:out
和 JSP EL
将显示输出到页面,但有一个主要区别。 c:out
标记将自动转义xml输出,这可能会阻止跨站点脚本。使用 JSP EL
(第二个选项)不会转义输出。
Both methods c:out
and JSP EL
will display output to the page, however there is one major difference. The c:out
tag will automatically escape xml output which can prevent cross site scripting. Using JSP EL
(the second option) will not escape the output.
显示已输入的数据时用户使用 c:out
标记而不是 JSP EL
来防止任何恶意数据输入显示在页面上。
When displaying data which has been inputted by a user use the c:out
tag instead of JSP EL
to prevent any malicious data input from displaying on the page.
这篇关于c:out和使用$打印输出之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!