Class ContainsPropertyTag

  • All Implemented Interfaces:
    javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

    public class ContainsPropertyTag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
    Implements the containsProperty tag. Checks whether the class specified by attribute object has a certain method that return property , which is specified by attribute property. The result of the check can be placed in the pageContext under the key specified by the attribute var. Example:
            <wmedit:containsProperty var="prop" object="${editcontext.baseObject}" 
                                              property="propertyName" />
     
    This tag checks if object class set with ${editcontext.baseObject} parameter contains getter method for propertyName parameter. Boolean value is converted to String and bind to prop variable in the page context. This variable may later be used in page to, for example, display or omit parts of the page.
    Author:
    md.pavkovic version 1.0
    • Constructor Detail

      • ContainsPropertyTag

        public ContainsPropertyTag()
    • Method Detail

      • getVar

        public String getVar()
        Return the name of the variable to which the 'true' or 'false' value will be assigned or null if not set.
        Returns:
        the var
      • setVar

        public void setVar​(String var)
        Setter for the optional var attribute.
        Parameters:
        var - the var to set
      • getObject

        public Object getObject()
        Return the required object class attribute
        Returns:
        the object
      • setObject

        public void setObject​(Object object)
        Setter for the required object attribute.
        Parameters:
        object - the object to set
      • getProperty

        public String getProperty()
        Returns the required property attribute.
        Returns:
        the property
      • setProperty

        public void setProperty​(String property)
        Setter for the required property attribute.
        Parameters:
        property - the property to set
      • containsProperty

        public boolean containsProperty()
        Check if Class contains getter method for attribute property.
        Returns:
        true if class contains getMethodName or isMethodName getter method for given property otherwise return false
      • doTag

        public void doTag()
                   throws javax.servlet.jsp.JspException
        Sets the key in the pageContext specified by attribute var
        Specified by:
        doTag in interface javax.servlet.jsp.tagext.SimpleTag
        Overrides:
        doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
        Throws:
        javax.servlet.jsp.JspException
        See Also:
        SimpleTag.doTag()