2013-05-15 93 views
1

以下哪种语法是正确的?<c:out> in jsp for hidden type

<input type="hidden" name="outagetkt" value="<c:out value='${ppshOutageAttrib.attributeHM['OutageType']}'></c:out>"/> 

<input type="hidden" name="outagetkt" value="<c:out value="${ppshOutageAttrib.attributeHM['OutageType']}"></c:out>"/> 

当我使用之前,“$”“双引号”与逃逸字符是这样的:

<input type="hidden" name="outagetkt" value="<c:out value=\"${ppshOutageAttrib.attributeHM['OutageType']}\"></c:out>"/> 

这并没有任何work..Can一个告诉我正确的语法?

+0

当你尝试它们时会发生什么? –

+0

........这是输出 –

+0

您输出的两种语法之一是什么? –

回答

0

至于<c:out>替代你可以使用fn:escapeXml()功能:

<input type="hidden" name="outagetkt" value="${fn:escapeXml(ppshOutageAttrib.attributeHM['OutageType'])}" /> 

这将消除需要嵌套<c:out>和降低报价的数量。

为此,您需要在JSP中指定函数标签库指令(如果尚未指定)。

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
相关问题