com.ora.jsp.tags.generic
Class MenuItemTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--com.ora.jsp.tags.generic.MenuItemTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, ParamParent, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class MenuItemTag
extends javax.servlet.jsp.tagext.BodyTagSupport
implements ParamParent

This class is a custom action for inserting HTML references in a navigation menu. If the action is used in a page with requested with a URI that corresponds to the page attribute, only the HTML text is included, otherwise an HTML reference (...) element is used to enclose the HTML text. The action also encodes the page URI for URL rewriting with possible parameter values URL encoded.

Version:
1.0
Author:
Hans Bergsten, Gefion software
See Also:
Serialized Form

Inner Class Summary
(package private)  class MenuItemTag.Param
          This is a helper class that holds the name and value of a parameter.
 
Field Summary
private  java.lang.String html
           
private  java.lang.String page
           
private  java.util.Vector params
           
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext, parent, values
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
MenuItemTag()
           
 
Method Summary
 int doAfterBody()
          Sets the html attribute.
 int doEndTag()
          Writes the HTML to the current output, enclosed in an HTML reference element (...) if the page attribute doesn't correspond to the current page.
 void release()
          Releases all instance variables.
 void setPage(java.lang.String page)
          Sets the page attribute.
 void setParam(java.lang.String name, java.lang.String value)
          Adds a parameter name and value.
private  java.lang.String toContextRelative(java.lang.String relURI, java.lang.String currURI)
          Returns a page-relative or context-relative path URI as a context-relative URI.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, doStartTag, 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, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

page

private java.lang.String page

html

private java.lang.String html

params

private java.util.Vector params
Constructor Detail

MenuItemTag

public MenuItemTag()
Method Detail

setPage

public void setPage(java.lang.String page)
Sets the page attribute.
Parameters:
page - the page URI value

doAfterBody

public int doAfterBody()
Sets the html attribute.
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Parameters:
html - the HTML to use for the item

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
Adds a parameter name and value. This method is called by param tags in the action body.
Specified by:
setParam in interface ParamParent
Parameters:
name - the parameter name
value - the URL encoded parameter value

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Writes the HTML to the current output, enclosed in an HTML reference element (...) if the page attribute doesn't correspond to the current page. If a reference is used, appends possible URL encoded parameters to the main URL, encodes the result for URL rewriting and writes the result to the JspWriter.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport

release

public void release()
Releases all instance variables.
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport

toContextRelative

private java.lang.String toContextRelative(java.lang.String relURI,
                                           java.lang.String currURI)
                                    throws javax.servlet.jsp.JspException
Returns a page-relative or context-relative path URI as a context-relative URI.
Parameters:
relURI - the page or context-relative URI
currURI - the context-relative URI for the current request
Throws:
javax.servlet.jsp.JspException - if the relURI is invalid