当前位置: 代码迷 >> Web前端 >> Struts s:property 标签的施用
  详细解决方案

Struts s:property 标签的施用

热度:363   发布时间:2012-08-21 13:00:22.0
Struts s:property 标签的使用

?

1. <s:property value="%{'<li>刘庆</li>'}" />

?

会显示

<li>刘庆</li>

?

2. 我们要显示html 而不是转意思后的文本

?

<s:property value="stateText" escape="false" />

?

escape

innerHTML

就OK

?

Name

Required

Default

Evaluated

Type

Description

default false ? false String The default value to be used if?value?attribute is null
escape false true false Boolean Deprecated. Use 'escapeHtml'. Whether to escape HTML
escapeCsv false false false Boolean Whether to escape CSV (useful to escape a value for a column)
escapeHtml false true false Boolean Whether to escape HTML
escapeJavaScript false false false Boolean Whether to escape Javascript
escapeXml false false false Boolean Whether to escape XML
value false <top of stack> false Object Value to be displayed

?

?

Examples

<s:push value="myBean">
    <!-- Example 1: -->
    <s:property value="myBeanProperty" />

    <!-- Example 2: -->TextUtils
    <s:property value="myBeanProperty" default="a default value" />
</s:push>

Example 1 prints the result of myBean's getMyBeanProperty() method.
Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead.
  相关解决方案