Class TextTag

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

    public class TextTag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
    Implements the wm:text tag. This tag looks up the text value defined for a language label as configured in GX Webmanager. The configuration can be found in the menu 'Configure > Language Labels' in the WM editor environment. If the var attribute is set, the result is bound to this variable, else the result of the lookup is printed.
    Examples of usage:
     < wm:text var="submitText" label="wm_language.form_submit" />
     < input type="submit" name="${submitText}" />
     
    In the example above the text defined for the label "wm_language.form_submit" is retrieved for the current language. A button using this text is displayed.
     <label><wm:text label="search" escapeTo="html" /></label>
     
    In the example above the text defined for the label "search" is retrieved from the current language and displayed within a html label tag. The text is escaped for usage in html. When the label does not exist, a new label is created automatically with the same name. The new label can only consist of the following characters:
     [0-9,a-z,A-Z,-,_]
     
    • Constructor Summary

      Constructors 
      Constructor Description
      TextTag()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doTag()  
      String getEscapeTo()
      Returns the type of format the text which is rendered should be escaped to when rendering it directly.
      protected String getLabel()
      Return the label for which the text must be retrieved.
      protected String getVar()
      Return name of the JSP variable to which the text will be assigned or null, if not set.
      void setEscapeTo​(String escapeTo)
      Sets the type of format the text which is rendered should be escaped to when rendering it directly.
      void setLabel​(String label)
      Specifies the label for which the text must be retrieved.
      void setVar​(String var)
      Specifies the JSP variable to store the result in.
      • Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport

        findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
    • Constructor Detail

      • TextTag

        public TextTag()
    • Method Detail

      • setVar

        public void setVar​(String var)
        Specifies the JSP variable to store the result in.
        Parameters:
        var - name of the variable to which the text will be assigned.
      • getVar

        protected String getVar()
        Return name of the JSP variable to which the text will be assigned or null, if not set.
        Returns:
        name of the variable to which the text will be assigned or null if not set.
      • setLabel

        public void setLabel​(String label)
        Specifies the label for which the text must be retrieved.
        Parameters:
        label - name of the language label
      • getLabel

        protected String getLabel()
        Return the label for which the text must be retrieved.
        Returns:
        the language label.
      • getEscapeTo

        public final String getEscapeTo()
        Returns the type of format the text which is rendered should be escaped to when rendering it directly. Possible return values are "html", "javascript", "querystring" or null.
        Returns:
        the type of format the text which is rendered should be escapde to when rendering it directly. Possible return values are "html", "javascript", "querystring" or null
      • setEscapeTo

        public final void setEscapeTo​(String escapeTo)
        Sets the type of format the text which is rendered should be escaped to when rendering it directly. Possible values are "html", "javascript", "querystring" or null. Other values will be treaded as null.
        Parameters:
        escapeTo - the type of format the text which is rendered should be escaped to when rendering it directly. Possible values are "html", "javascript", "querystring" or null. Other values will be treaded as null
      • doTag

        public void doTag()
                   throws javax.servlet.jsp.JspException
        Specified by:
        doTag in interface javax.servlet.jsp.tagext.SimpleTag
        Overrides:
        doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
        Throws:
        javax.servlet.jsp.JspException