org.apache.struts.taglib.bean

Class WriteTag

public class WriteTag extends TagSupport

Tag that retrieves the specified property of the specified bean, converts it to a String representation (if necessary), and writes it to the current output stream, optionally filtering characters that are sensitive in HTML.

Version: $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $

Field Summary
protected Stringbundle
The servlet context attribute key for our resources.
static StringDATE_FORMAT_KEY
The key to search default format string for java.util.Date in resources.
protected booleanfilter
Filter the rendered output for characters that are sensitive in HTML?
protected StringformatKey
The key to search format string in applciation resources
protected StringformatStr
The format string to be used as format to convert value to String.
static StringFLOAT_FORMAT_KEY
The key to search default format string for float (double, BigDecimal) in resources.
protected booleanignore
Should we ignore missing beans and simply output nothing?
static StringINT_FORMAT_KEY
The key to search default format string for int (byte, short, etc.) in resources.
protected StringlocaleKey
The session scope key under which our Locale is stored.
protected static MessageResourcesmessages
The message resources for this package.
protected Stringname
Name of the bean that contains the data we will be rendering.
protected Stringproperty
Name of the property to be accessed on the specified bean.
protected Stringscope
The scope to be searched to retrieve the specified bean.
static StringSQL_DATE_FORMAT_KEY
The key to search default format string for java.sql.Date in resources.
static StringSQL_TIMESTAMP_FORMAT_KEY
The key to search default format string for java.sql.Timestamp in resources.
static StringSQL_TIME_FORMAT_KEY
The key to search default format string for java.sql.Time in resources.
Method Summary
intdoStartTag()
Process the start tag.
protected StringformatValue(Object valueToFormat)
Format value according to specified format string (as tag attribute or as string from message resources) or to current user locale.
StringgetBundle()
booleangetFilter()
StringgetFormat()
StringgetFormatKey()
booleangetIgnore()
StringgetLocale()
StringgetName()
StringgetProperty()
StringgetScope()
voidrelease()
Release all allocated resources.
protected StringretrieveFormatString(String formatKey)
Retrieve format string from message bundle and return null if message not found or message string.
voidsetBundle(String bundle)
voidsetFilter(boolean filter)
voidsetFormat(String formatStr)
voidsetFormatKey(String formatKey)
voidsetIgnore(boolean ignore)
voidsetLocale(String localeKey)
voidsetName(String name)
voidsetProperty(String property)
voidsetScope(String scope)

Field Detail

bundle

protected String bundle
The servlet context attribute key for our resources.

DATE_FORMAT_KEY

public static final String DATE_FORMAT_KEY
The key to search default format string for java.util.Date in resources.

filter

protected boolean filter
Filter the rendered output for characters that are sensitive in HTML?

formatKey

protected String formatKey
The key to search format string in applciation resources

formatStr

protected String formatStr
The format string to be used as format to convert value to String.

FLOAT_FORMAT_KEY

public static final String FLOAT_FORMAT_KEY
The key to search default format string for float (double, BigDecimal) in resources.

ignore

protected boolean ignore
Should we ignore missing beans and simply output nothing?

INT_FORMAT_KEY

public static final String INT_FORMAT_KEY
The key to search default format string for int (byte, short, etc.) in resources.

localeKey

protected String localeKey
The session scope key under which our Locale is stored.

messages

protected static MessageResources messages
The message resources for this package.

name

protected String name
Name of the bean that contains the data we will be rendering.

property

protected String property
Name of the property to be accessed on the specified bean.

scope

protected String scope
The scope to be searched to retrieve the specified bean.

SQL_DATE_FORMAT_KEY

public static final String SQL_DATE_FORMAT_KEY
The key to search default format string for java.sql.Date in resources.

SQL_TIMESTAMP_FORMAT_KEY

public static final String SQL_TIMESTAMP_FORMAT_KEY
The key to search default format string for java.sql.Timestamp in resources.

SQL_TIME_FORMAT_KEY

public static final String SQL_TIME_FORMAT_KEY
The key to search default format string for java.sql.Time in resources.

Method Detail

doStartTag

public int doStartTag()
Process the start tag.

Throws: JspException if a JSP exception has occurred

formatValue

protected String formatValue(Object valueToFormat)
Format value according to specified format string (as tag attribute or as string from message resources) or to current user locale. When a format string is retrieved from the message resources, applyLocalizedPattern is used. For more about localized patterns, see . (To obtain the correct value for some characters, you may need to view the file in a hex editor and then use the Unicode escape form in the property resources file.)

Parameters: valueToFormat value to process and convert to String

Throws: JspException if a JSP exception has occurred

getBundle

public String getBundle()

getFilter

public boolean getFilter()

getFormat

public String getFormat()

getFormatKey

public String getFormatKey()

getIgnore

public boolean getIgnore()

getLocale

public String getLocale()

getName

public String getName()

getProperty

public String getProperty()

getScope

public String getScope()

release

public void release()
Release all allocated resources.

retrieveFormatString

protected String retrieveFormatString(String formatKey)
Retrieve format string from message bundle and return null if message not found or message string.

Parameters: formatKey value to use as key to search message in bundle

Throws: JspException if a JSP exception has occurred

setBundle

public void setBundle(String bundle)

setFilter

public void setFilter(boolean filter)

setFormat

public void setFormat(String formatStr)

setFormatKey

public void setFormatKey(String formatKey)

setIgnore

public void setIgnore(boolean ignore)

setLocale

public void setLocale(String localeKey)

setName

public void setName(String name)

setProperty

public void setProperty(String property)

setScope

public void setScope(String scope)
Copyright © 2000-2008 - The Apache Software Foundation