⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e1068. saving and emitting html fragments using jstl in a jsp page.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
When saving text with the special characters <>'"&, the special characters are save as is; there is no translation that takes place. However, when emitting text with <c:out>, these special characters are translated to the equivalent XML entities. In particular, < becomes &lt;, > becomes &gt;, ' becomes &#039;, " becomes &#034;, and & becomes &amp;. This means that a value such as <b> will be emitted as &lt;b&gt; and therefore not be interpreted as the HTML b tag. 
To prevent this translation, the escapeXml attribute must be specified and set to false: 

    <%-- Declare the core library --%>
    <%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
    
    <%-- Save data with html tags --%>
    <c:set var="msg" value="hi <b>John</b>!" scope="page" />
    
    <%-- Show the value after translating special characters --%>
    <c:out value='${msg}' />
    
    <%-- Show the value without translating special characters --%>
    <c:out value='${msg}' escapeXml="false" />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -