jp.terasoluna.fw.web.struts.taglib
Class BodyTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by jp.terasoluna.fw.web.struts.taglib.BodyTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class BodyTag
extends javax.servlet.jsp.tagext.TagSupport

Implementation class of body tag that extends body tag of HTML.

In PageContext, use "ON_LOAD" as a key and add the embedded script to the onLoad event process.
In HTML <body> tag which is generated in this tag, JavaScript function __onLoad__() is called as the script of onLoad event process. Since the definition of JavaScript function __onLoad__() is generated in this tag, JavaScript with same name should not be described in HTML.

Attributes of this tag namely, "styleClass","bgcolor", "text","link", "vlink"and "alink" are deployed as the <body> tag attributes of HTML which is generated in this tag.


Attributes supported by tag

In body tag, following attributes are supported.



Attribute name Default value Required Execution time format Overview
onload - false true JavaScript which is executed at the time of screen loading.
onunload - false true JavaScript which is executed at the time of screen unloading.
styleClass - false true Class name of style sheet.
bgcolor - false true Background color.
background - false true Image set in the background.
text - false true Color of text.
link - false true Color of link.
vlink - false true Color of already selected link.
alink - false true Color of selected link.


Scripting variable of custom tag

There is no scripting variable which is set by this tag.


How to use
  • JSP
  •   <%
        String script="Any script";
        pageContext.setAttribute("ON_LOAD", script);
      %>
      ,,,
      <ts:body>
      ,,,
      </ts:body>
     
  • HTML which is generated
  •   <body onLoad="__onLoad__()">
        <script type="text/javascript">
          <!--
            function __onLoad__() {
              //Script in which key is stored in "ON_LOAD" pageContext.
            }
          //-->
        </script>
      ,,,
      </body>
     

    See Also:
    MessagesPopupTag, Serialized Form

    Field Summary
    private  java.lang.String alink
              Color of selected link.
    private  java.lang.String background
              Image which is set in the background.
    private  java.lang.String bgcolor
              Background color.
    private  java.lang.String link
              Color of link.
    private static org.apache.commons.logging.Log log
              Log class.
    static java.lang.String ON_LOAD_KEY
              Key of request attribute to retrieve the script which is added to onLoad event process.
    private  java.lang.String onload
              JavaScript which is executed at the time of screen loading.
    private  java.lang.String onunload
              JavaScript which is executed at the time of screen unloading.
    private static long serialVersionUID
              Serial version ID
    private  java.lang.String styleClass
              Class name of style sheet.
    private  java.lang.String text
              Color of the text.
    private  java.lang.String vlink
              Color of already selected link.
     
    Fields inherited from class javax.servlet.jsp.tagext.TagSupport
    id, pageContext
     
    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
    BodyTag()
               
     
    Method Summary
     int doEndTag()
              Method which is called at the time of ending tag evaluation.
     int doStartTag()
              Method wich is called at the time of starting tag evaluation.
     void release()
              Process at the time of releasing the tag handler.
     void setAlink(java.lang.String value)
              Sets the color of selected link.
     void setBackground(java.lang.String value)
              Sets the background image.
     void setBgcolor(java.lang.String value)
              Sets the background color.
     void setLink(java.lang.String value)
              Sets the color of link.
     void setOnload(java.lang.String value)
              Sets the JavaScript which is executed at the time of screen loading.
     void setOnunload(java.lang.String value)
              Sets JavaScript which is executed at the time of screen unloading.
     void setStyleClass(java.lang.String value)
              Sets the class name of style sheet.
     void setText(java.lang.String value)
              Sets color of text.
     void setVlink(java.lang.String value)
              Sets color of already selected link.
     
    Methods inherited from class javax.servlet.jsp.tagext.TagSupport
    doAfterBody, 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
     

    Field Detail

    serialVersionUID

    private static final long serialVersionUID
    Serial version ID

    See Also:
    Constant Field Values

    log

    private static org.apache.commons.logging.Log log
    Log class.


    ON_LOAD_KEY

    public static final java.lang.String ON_LOAD_KEY
    Key of request attribute to retrieve the script which is added to onLoad event process.

    See Also:
    Constant Field Values

    onload

    private java.lang.String onload
    JavaScript which is executed at the time ofscreen loading.


    onunload

    private java.lang.String onunload
    JavaScript which is executed at the time of screen unloading.


    styleClass

    private java.lang.String styleClass
    Class name of style sheet.


    bgcolor

    private java.lang.String bgcolor
    Background color.


    background

    private java.lang.String background
    Image which is set in the background.


    text

    private java.lang.String text
    Color of text.


    link

    private java.lang.String link
    Color of link.


    vlink

    private java.lang.String vlink
    Color of already selected link.


    alink

    private java.lang.String alink
    Color of selected link.

    Constructor Detail

    BodyTag

    public BodyTag()
    Method Detail

    setOnload

    public void setOnload(java.lang.String value)
    Sets JavaScript which is executed at the time of screen loading.

    Parameters:
    value - JavaScript

    setOnunload

    public void setOnunload(java.lang.String value)
    Sets JavaScript which is executed at the time of screen unloading.

    Parameters:
    value - JavaScript

    setStyleClass

    public void setStyleClass(java.lang.String value)
    Sets class name of style sheet.

    Parameters:
    value - Class name

    setBgcolor

    public void setBgcolor(java.lang.String value)
    Sets background color.

    Parameters:
    value - Background color

    setBackground

    public void setBackground(java.lang.String value)
    Sets background image.

    Parameters:
    value - Background color

    setText

    public void setText(java.lang.String value)
    Sets colro of text.

    Parameters:
    value - Color of text

    setLink

    public void setLink(java.lang.String value)
    Sets color of link.

    Parameters:
    value - Color of link

    setVlink

    public void setVlink(java.lang.String value)
    Sets the color of already selected link.

    Parameters:
    value - Color of already selected link

    setAlink

    public void setAlink(java.lang.String value)
    Sets color of selected link.

    Parameters:
    value - Color of selected link

    doStartTag

    public int doStartTag()
                   throws javax.servlet.jsp.JspException
    Method which is called at the time of starting tag evaluation.

    Specified by:
    doStartTag in interface javax.servlet.jsp.tagext.Tag
    Overrides:
    doStartTag in class javax.servlet.jsp.tagext.TagSupport
    Returns:
    PRocess control instructions. Always EVAL_BODY_INCLUDE
    Throws:
    javax.servlet.jsp.JspException - JSP exception

    doEndTag

    public int doEndTag()
                 throws javax.servlet.jsp.JspException
    Method which is called at the time of ending tag evaluation.

    Specified by:
    doEndTag in interface javax.servlet.jsp.tagext.Tag
    Overrides:
    doEndTag in class javax.servlet.jsp.tagext.TagSupport
    Returns:
    Process control instructions. Always EVAL_PAGE
    Throws:
    javax.servlet.jsp.JspException - JSP exception

    release

    public void release()
    Process at the time of releasing the tag handler.

    Specified by:
    release in interface javax.servlet.jsp.tagext.Tag
    Overrides:
    release in class javax.servlet.jsp.tagext.TagSupport