Class LinkTag

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

    public class LinkTag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
    implements javax.servlet.jsp.tagext.DynamicAttributes
    Implements the wm:link tag. Using this tag, link objects can be constructed that refer to pages, downloads, etc. This tag supports dynamic attributes (i.e. you can specify your own attributes) which are passed on to the Link object that is created.
    Example of usage (1): *
     < wm:link var="aLinkObject" linkText="clickme" foo="bar" target="_top" />
     ${aLinkObject.htmlTag}
     
    In the example above a new link object is created referencing the current page. It is assigned to 'aLinkObject'. Using dynamic attributes a custom attribute 'foo' is defined. The link is opened in the '_top' section of the window.
    Example of usage (2):
     < wm:link var="homepage" reference="${presentationcontext.website.homePage}" linkText="to the homepage" />
     Click here to go ${homepage.htmlTag}.
     
    It is also possible to encapsulate a portion of jsp code, which is rendered in the resulting link's inner HTML without further escaping.
    Example of usage (3):
     <wm:link var="homepage" reference="${presentationcontext.website.homePage}"><img src="home.png" /></wm:link>
     ${homepage.htmlTag}
     
    See Also:
    Link
    • Constructor Summary

      Constructors 
      Constructor Description
      LinkTag()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doTag()  
      protected String getClassName()
      Return the class name to be used in the 'class="..."' attribute of the resulting HTML link.
      protected String getLinkText()
      Return the text to use when displaying the HTML link.
      protected String getMouseOverText()
      Return the text to be used in the 'title="..."' attribute of the resulting HTML link.
      protected String getPassOn()
      Return the comma separated list of all URL parameters of the current request that need to be included in the link that is built.
      protected String getPresentationName()
      Return the WebManager presentation object by which the link is rendered.
      protected Wrapper getReference()
      Return the page to link to.
      protected String getRel()
      Return the attribute to be used in the 'rel="..."' attribute of the resulting HTML link.
      protected String getTarget()
      Return the target to be used in the 'target="..."' attribute of the resulting HTML link..
      protected String getVar()
      Return the JSP variable to store the result in.
      protected boolean isAddElementHolder()
      Returns true if the elementholder parameter should be added to a ssi link.
      protected boolean isPassOnAllParameters()
      Return whether all URL parameters of the current request are included in the link that is built.
      void setAddElementHolder​(boolean addElementHolder)
      Set whether the elementholder parameter should be added to a ssi link.
      void setClassName​(String className)
      Specifies the class name to be used in the 'class="..."' attribute of the resulting HTML link.
      void setDynamicAttribute​(String uri, String localName, Object value)  
      void setLinkText​(String linkText)
      Sets the text to use when displaying the HTML link.
      void setMouseOverText​(String mouseOverText)
      Specifies the text to be used in the 'title="..."' attribute of the resulting HTML link.
      void setPassOn​(String passOn)
      Specifies a comma separated list of all URL parameters of the current request that need to be included in the link that is built.
      void setPassOnAllParameters​(boolean passOnAllParameters)
      Specifies whether all URL parameters of the current request are included in the link that is built.
      void setPresentationName​(String presentationName)
      Specifies a WebManager presentation object.
      void setReference​(Wrapper reference)
      Page to link to.
      void setRel​(String relAttribute)
      Specifies the attribute to be used in the 'rel="..."' attribute of the resulting HTML link.
      void setTarget​(String target)
      Specifies the target to be used in the 'target="..."' attribute of the resulting HTML link.
      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

      • LinkTag

        public LinkTag()
    • Method Detail

      • setReference

        public void setReference​(Wrapper reference)
        Page to link to. If not set, the current page will be used.
        Parameters:
        reference -
      • getReference

        protected Wrapper getReference()
        Return the page to link to.
        Returns:
        reference for the link.
      • setVar

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

        protected String getVar()
        Return the JSP variable to store the result in.
        Returns:
        variable name to which the Link object will be assigned.
      • setPassOnAllParameters

        public void setPassOnAllParameters​(boolean passOnAllParameters)
        Specifies whether all URL parameters of the current request are included in the link that is built. Default value is false (don't include). Multiple parameters with the same name will all be included.
        Parameters:
        passOnAllParameters - if true all parameters in the link are passed on so the href will contain them in the querystring
      • isPassOnAllParameters

        protected boolean isPassOnAllParameters()
        Return whether all URL parameters of the current request are included in the link that is built. Default value is false (don't include).
        Returns:
        true if all parameters in the link are passed on so the href will contain them in the querystring.
      • setPassOn

        public void setPassOn​(String passOn)
        Specifies a comma separated list of all URL parameters of the current request that need to be included in the link that is built.
        Parameters:
        passOn - comma separated list of request parameters that need to be passed on in the querystring of the link.
      • getPassOn

        protected String getPassOn()
        Return the comma separated list of all URL parameters of the current request that need to be included in the link that is built.
        Returns:
        comma separated list of parameters
      • setLinkText

        public void setLinkText​(String linkText)
        Sets the text to use when displaying the HTML link. Default value is the title of the page that is linked to. You may also use this to create buttons. Simply make sure the img url is used as the link text.
        Parameters:
        linkText - link text that will appear between the <a> and </a>
      • getLinkText

        protected String getLinkText()
        Return the text to use when displaying the HTML link.
        Returns:
        link text that will appear between the <a> and </a>.
      • setPresentationName

        public void setPresentationName​(String presentationName)
        Specifies a WebManager presentation object. The link is rendered by this presentation.
        Parameters:
        presentationName - the name of the WebManager presentation object
      • getPresentationName

        protected String getPresentationName()
        Return the WebManager presentation object by which the link is rendered.
        Returns:
        the name of the WebManager presentation object by which the link is rendered
      • setClassName

        public void setClassName​(String className)
        Specifies the class name to be used in the 'class="..."' attribute of the resulting HTML link.
        Parameters:
        className - the class name to be used in the 'class="..."' attribute of the resulting HTML link
      • getClassName

        protected String getClassName()
        Return the class name to be used in the 'class="..."' attribute of the resulting HTML link.
        Returns:
        the class name to be used in the 'class="..."' attribute of the resulting HTML link.
      • setRel

        public void setRel​(String relAttribute)
        Specifies the attribute to be used in the 'rel="..."' attribute of the resulting HTML link.
        Parameters:
        relAttribute - the attribute to be used in the 'rel="..."' attribute of the resulting HTML link
      • getRel

        protected String getRel()
        Return the attribute to be used in the 'rel="..."' attribute of the resulting HTML link.
        Returns:
        the attribute to be used in the 'rel="..."' attribute of the resulting HTML link.
        Since:
        10.35.0
      • setTarget

        public void setTarget​(String target)
        Specifies the target to be used in the 'target="..."' attribute of the resulting HTML link. Using this attribute links can be opened in a new browser window. Default value is empty: the link will open in the current window.
        Parameters:
        target - the target to be used in the 'target="..."' attribute of the resulting HTML link
      • getTarget

        protected String getTarget()
        Return the target to be used in the 'target="..."' attribute of the resulting HTML link..
        Returns:
        the target to be used in the 'target="..."' attribute of the resulting HTML link
      • setMouseOverText

        public void setMouseOverText​(String mouseOverText)
        Specifies the text to be used in the 'title="..."' attribute of the resulting HTML link. This text is usually shown as a tooltip if the mouse cursor is placed over the link.
        Parameters:
        mouseOverText - the text to be used in the 'title="..."' attribute of the resulting HTML link
      • getMouseOverText

        protected String getMouseOverText()
        Return the text to be used in the 'title="..."' attribute of the resulting HTML link. This text is usually shown as a tooltip if the mouse cursor is placed over the link.
        Returns:
        the text to be used in the 'title="..."' attribute of the resulting HTML link
      • setAddElementHolder

        public void setAddElementHolder​(boolean addElementHolder)
        Set whether the elementholder parameter should be added to a ssi link. Only use in case of building a ssi link.
        Parameters:
        addElementHolder - boolean, when true the elementholder should be added to a ssi link.
      • isAddElementHolder

        protected boolean isAddElementHolder()
        Returns true if the elementholder parameter should be added to a ssi link. This method is only called when building an ssi link.
        Returns:
        True if the elementholder parameter should be added to a ssi link. This method is only called when building an ssi link.
      • setDynamicAttribute

        public void setDynamicAttribute​(String uri,
                                        String localName,
                                        Object value)
        Specified by:
        setDynamicAttribute in interface javax.servlet.jsp.tagext.DynamicAttributes
      • doTag

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