info.magnolia.cms.taglibs.util
Class RedirectTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by info.magnolia.cms.taglibs.util.RedirectTag
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class RedirectTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Redirects to the first child page. If the server is an authoring instance or magnolia and the preview mode is not active the tag will simply add to the pagecontext a variable named from the var attribute containing the path of the child page.

A typical requirement is to have pages with no content which will simply redirect to a child page: using this tag you can easily build a "redirect" template and use it for empty pages:

                         Title                    Template               Mod. Date
 -----------------------^----------------^-------^----------------------^---------------
 - siteroot             -                o       redirect                05-01-01
   - it                 -                o       redirect                05-01-01
     + home             Home page        o       home                    05-01-01

 

This tag should be put before any other tag or include in the page, since response should not be committed yet for it to work.

Example:

 <cmsu:redirect var="destpage" />

 This page has no content and it will redirect to
 <a href="${pageContext.request.contextPath}${destpage}">${destpage}</a> in a public instance.
 

Since:
2.2
Version:
$Id: RedirectTag.java 41137 2011-01-06 18:19:25Z gjoseph $
Author:
Fabrizio Giustina
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
RedirectTag()
           
 
Method Summary
 int doStartTag()
           
 void release()
           
 void setVar(String var)
          Name for the variable which will contain the URL of the page this tag will redirect to.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

RedirectTag

public RedirectTag()
Method Detail

setVar

public void setVar(String var)
Name for the variable which will contain the URL of the page this tag will redirect to.


doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doStartTag()

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport
See Also:
Tag.release()


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.