Class Property

java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.Property

public class Property extends Component

Used to get the property of a value, which will default to the top of the stack if none is specified.

  • default (String) - The default value to be used if value attribute is null
  • escapeCsv (Boolean) - Escape CSV. Defaults to false
  • escapeHtml (Boolean) - Escape HTML. Defaults to true
  • escapeJavaScript (Boolean) - Escape JavaScript. Defaults to false
  • escapeXml (Boolean) - Escape XML. Defaults to false
  • value (Object) - value to be displayed
 

 <s:push value="myBean">
     
     <s:property value="myBeanProperty" />

     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.
 
 
 

 <s:property value="getText('some.key')" />

 
 
  • Constructor Details

  • Method Details

    • setDefault

      public void setDefault(String defaultValue)
    • setEscapeHtml

      public void setEscapeHtml(boolean escape)
    • setEscapeJavaScript

      public void setEscapeJavaScript(boolean escapeJavaScript)
    • setValue

      public void setValue(String value)
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
    • setEscapeCsv

      public void setEscapeCsv(boolean escapeCsv)
    • setEscapeXml

      public void setEscapeXml(boolean escapeXml)
    • start

      public boolean start(Writer writer)
      Description copied from class: Component
      Callback for the start tag of this component. Should the body be evaluated?
      Overrides:
      start in class Component
      Parameters:
      writer - the output writer.
      Returns:
      true if the body should be evaluated