public class CenterTag extends TagSupport
By using optional attributes, it can also position the element against the left or right border and can provide the material with a class that can be referenced by the CSS style sheet.
| Modifier and Type | Field and Description |
|---|---|
protected String |
align
Value of the attribute
align for the
custom tag. |
protected String |
className
Value of the attribute
className for the
custom tag. |
protected String |
style
Value of the attribute
style for the
custom tag. |
id, pageContextEVAL_BODY_AGAINEVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE| Constructor and Description |
|---|
CenterTag() |
| Modifier and Type | Method and Description |
|---|---|
int |
doEndTag()
Writes test for the JSP when the closing tag for the custom
tag is encountered.
|
int |
doStartTag()
Writes text for the JSP (Java Server Page) when the opening tag
of the custom tag is encountered.
|
String |
getAlign()
Returns the value of the attribute
align for the
custom tag. |
String |
getClassName()
Returns the value of the attribute
className
for the custom tag. |
protected String |
getStyle()
Returns the value of the attribute
style
for the custom tag. |
void |
setAlign(String value)
Used by the servlet generated by the application server to
set the value of the attribute
align
for the custom tag. |
void |
setClassName(String value)
Used by the application server to set the
value of the variable className when it is
encountered as an attribute in the custom tags.
|
void |
setPageContext(PageContext context) |
protected void |
setStyle(String value)
Used by the application server to set the
value of the variable
style when it is
encountered as an attribute in the
custom tags. |
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValueprotected String className
className for the
custom tag.
When the tag is translated into a scriptlet, this
attribute becomes the value of the class
attribute for a div element. However,
class is a reserved word in Java, requiring the use
of a different name for the attribute.
public CenterTag()
public void setAlign(String value)
align
for the custom tag.
The name of the attribute is passed to the application server in the TLD file so that the application server can use the name of the attribute to write function calls with the correct class names.
value - Value to be used for attribute alignalignpublic String getAlign()
align for the
custom tag.alignpublic void setClassName(String value)
value - Value to be used for attribute classNameclassNamepublic String getClassName()
className
for the custom tag.classNameprotected void setStyle(String value)
style when it is
encountered as an attribute in the
custom tags.value - Value to be used for attribute stylestyleprotected String getStyle()
style
for the custom tag.stylepublic void setPageContext(PageContext context)
setPageContext in interface TagsetPageContext in class TagSupportpublic int doStartTag() throws JspException
The block of text is surrounded by a table since a table's width will automatically shrink if the sum of the column widths is less that the available width. Setting margin-left and margin-right to auto causes the table to be centered in this situation.
The method returns Tag.EVAL_BODY_INCLUDE to indicate that
the material in the body of the tag will be processed by the
JSP preprocessor.
doStartTag in interface TagdoStartTag in class TagSupportJspExceptionpublic int doEndTag() throws JspException
The method returns Tag.EVAL_PAGE to indicate
that processing of the Java Server Page should continue.
doEndTag in interface TagdoEndTag in class TagSupportJspException