|
|||||||||
| Home >> All >> org >> apache >> struts >> [ taglib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.struts.taglib
Class TagUtils

java.lang.Objectorg.apache.struts.taglib.TagUtils
- public class TagUtils
- extends java.lang.Object
Provides helper methods for JSP tags.
- Since:
- Struts 1.2
- Version:
- $Rev: 384235 $
| Field Summary | |
private static TagUtils |
instance
The Singleton instance. |
private static org.apache.commons.logging.Log |
log
Commons logging instance. |
private static org.apache.struts.util.MessageResources |
messages
The message resources for this package. |
private static java.util.Map |
scopes
Maps lowercase JSP scope names to their PageContext integer constant values. |
| Constructor Summary | |
protected |
TagUtils()
Constructor for TagUtils. |
| Method Summary | |
java.util.Map |
computeParameters(javax.servlet.jsp.PageContext pageContext,
java.lang.String paramId,
java.lang.String paramName,
java.lang.String paramProperty,
java.lang.String paramScope,
java.lang.String name,
java.lang.String property,
java.lang.String scope,
boolean transaction)
Compute a set of query parameters that will be dynamically added to a generated URL. |
java.lang.String |
computeURL(javax.servlet.jsp.PageContext pageContext,
java.lang.String forward,
java.lang.String href,
java.lang.String page,
java.lang.String action,
java.lang.String module,
java.util.Map params,
java.lang.String anchor,
boolean redirect)
|
java.lang.String |
computeURL(javax.servlet.jsp.PageContext pageContext,
java.lang.String forward,
java.lang.String href,
java.lang.String page,
java.lang.String action,
java.lang.String module,
java.util.Map params,
java.lang.String anchor,
boolean redirect,
boolean encodeSeparator)
|
java.lang.String |
computeURLWithCharEncoding(javax.servlet.jsp.PageContext pageContext,
java.lang.String forward,
java.lang.String href,
java.lang.String page,
java.lang.String action,
java.lang.String module,
java.util.Map params,
java.lang.String anchor,
boolean redirect,
boolean useLocalEncoding)
Compute a hyperlink URL based on the forward,
href, action or page parameter
that is not null. |
java.lang.String |
computeURLWithCharEncoding(javax.servlet.jsp.PageContext pageContext,
java.lang.String forward,
java.lang.String href,
java.lang.String page,
java.lang.String action,
java.lang.String module,
java.util.Map params,
java.lang.String anchor,
boolean redirect,
boolean encodeSeparator,
boolean useLocalEncoding)
Compute a hyperlink URL based on the forward,
href, action or page parameter
that is not null. |
java.lang.String |
encodeURL(java.lang.String url)
URLencodes a string assuming the character encoding is UTF-8. |
java.lang.String |
encodeURL(java.lang.String url,
java.lang.String enc)
Use the new URLEncoder.encode() method from Java 1.4 if available, else use the old deprecated version. |
java.lang.String |
filter(java.lang.String value)
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities. |
org.apache.struts.action.ActionErrors |
getActionErrors(javax.servlet.jsp.PageContext pageContext,
java.lang.String paramName)
Deprecated. Use getActionMessages() instead. This will be removed after Struts 1.2. |
java.lang.String |
getActionMappingName(java.lang.String action)
Return the form action converted into an action mapping path. |
java.lang.String |
getActionMappingURL(java.lang.String action,
javax.servlet.jsp.PageContext pageContext)
Return the form action converted into a server-relative URL. |
java.lang.String |
getActionMappingURL(java.lang.String action,
java.lang.String module,
javax.servlet.jsp.PageContext pageContext,
boolean contextRelative)
Return the form action converted into a server-relative URL. |
org.apache.struts.action.ActionMessages |
getActionMessages(javax.servlet.jsp.PageContext pageContext,
java.lang.String paramName)
Retrieves the value from request scope and if it isn't already an ActionMessages, some classes are converted to one. |
static TagUtils |
getInstance()
Returns the Singleton instance of TagUtils. |
org.apache.struts.config.ModuleConfig |
getModuleConfig(javax.servlet.jsp.PageContext pageContext)
Return the ModuleConfig object if it exists, null if otherwise. |
org.apache.struts.config.ModuleConfig |
getModuleConfig(java.lang.String module,
javax.servlet.jsp.PageContext pageContext)
Return the ModuleConfig object for the given prefix if it exists, null if otherwise. |
int |
getScope(java.lang.String scopeName)
Converts the scope name into its corresponding PageContext constant value. |
java.util.Locale |
getUserLocale(javax.servlet.jsp.PageContext pageContext,
java.lang.String locale)
Look up and return current user locale, based on the specified parameters. |
boolean |
isXhtml(javax.servlet.jsp.PageContext pageContext)
Returns true if the custom tags are in XHTML mode. |
java.lang.Object |
lookup(javax.servlet.jsp.PageContext pageContext,
java.lang.String name,
java.lang.String scopeName)
Locate and return the specified bean, from an optionally specified scope, in the specified page context. |
java.lang.Object |
lookup(javax.servlet.jsp.PageContext pageContext,
java.lang.String name,
java.lang.String property,
java.lang.String scope)
Locate and return the specified property of the specified bean, from an optionally specified scope, in the specified page context. |
java.lang.String |
message(javax.servlet.jsp.PageContext pageContext,
java.lang.String bundle,
java.lang.String locale,
java.lang.String key)
Look up and return a message string, based on the specified parameters. |
java.lang.String |
message(javax.servlet.jsp.PageContext pageContext,
java.lang.String bundle,
java.lang.String locale,
java.lang.String key,
java.lang.Object[] args)
Look up and return a message string, based on the specified parameters. |
java.lang.String |
pageURL(javax.servlet.http.HttpServletRequest request,
java.lang.String page,
org.apache.struts.config.ModuleConfig moduleConfig)
Return the context-relative URL that corresponds to the specified page attribute value, calculated based on the
pagePattern property of the current module's
org.apache.struts.config.ModuleConfig. |
boolean |
present(javax.servlet.jsp.PageContext pageContext,
java.lang.String bundle,
java.lang.String locale,
java.lang.String key)
Return true if a message string for the specified message key is present for the specified Locale. |
org.apache.struts.util.MessageResources |
retrieveMessageResources(javax.servlet.jsp.PageContext pageContext,
java.lang.String bundle,
boolean checkPageScope)
Returns the appropriate MessageResources object for the current module and the given bundle. |
void |
saveException(javax.servlet.jsp.PageContext pageContext,
java.lang.Throwable exception)
Save the specified exception as a request attribute for later use. |
void |
write(javax.servlet.jsp.PageContext pageContext,
java.lang.String text)
Write the specified text as the response to the writer associated with this page. |
void |
writePrevious(javax.servlet.jsp.PageContext pageContext,
java.lang.String text)
Write the specified text as the response to the writer associated with the body content for the tag within which we are currently nested. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
instance
private static final TagUtils instance
- The Singleton instance.
log
private static final org.apache.commons.logging.Log log
- Commons logging instance.
messages
private static final org.apache.struts.util.MessageResources messages
- The message resources for this package.
TODO We need to move the relevant messages out of this properties file.
scopes
private static final java.util.Map scopes
- Maps lowercase JSP scope names to their PageContext integer constant
values.
| Constructor Detail |
TagUtils
protected TagUtils()
- Constructor for TagUtils.
| Method Detail |
getInstance
public static TagUtils getInstance()
- Returns the Singleton instance of TagUtils.
computeParameters
public java.util.Map computeParameters(javax.servlet.jsp.PageContext pageContext, java.lang.String paramId, java.lang.String paramName, java.lang.String paramProperty, java.lang.String paramScope, java.lang.String name, java.lang.String property, java.lang.String scope, boolean transaction) throws javax.servlet.jsp.JspException
- Compute a set of query parameters that will be dynamically added to
a generated URL. The returned Map is keyed by parameter name, and the
values are either null (no value specified), a String (single value
specified), or a String[] array (multiple values specified). Parameter
names correspond to the corresponding attributes of the
<html:link>tag. If no query parameters are identified, returnnull.
computeURL
public java.lang.String computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect) throws java.net.MalformedURLException
computeURLWithCharEncoding
public java.lang.String computeURLWithCharEncoding(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect, boolean useLocalEncoding) throws java.net.MalformedURLException
- Compute a hyperlink URL based on the
forward,href,actionorpageparameter that is not null. The returned URL will have already been passed toresponse.encodeURL()for adding a session identifier.
computeURL
public java.lang.String computeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect, boolean encodeSeparator) throws java.net.MalformedURLException
computeURLWithCharEncoding
public java.lang.String computeURLWithCharEncoding(javax.servlet.jsp.PageContext pageContext, java.lang.String forward, java.lang.String href, java.lang.String page, java.lang.String action, java.lang.String module, java.util.Map params, java.lang.String anchor, boolean redirect, boolean encodeSeparator, boolean useLocalEncoding) throws java.net.MalformedURLException
- Compute a hyperlink URL based on the
forward,href,actionorpageparameter that is not null. The returned URL will have already been passed toresponse.encodeURL()for adding a session identifier.
encodeURL
public java.lang.String encodeURL(java.lang.String url)
- URLencodes a string assuming the character encoding is UTF-8.
encodeURL
public java.lang.String encodeURL(java.lang.String url, java.lang.String enc)
- Use the new URLEncoder.encode() method from Java 1.4 if available, else
use the old deprecated version. This method uses reflection to find the
appropriate method; if the reflection operations throw exceptions, this
will return the url encoded with the old URLEncoder.encode() method.
filter
public java.lang.String filter(java.lang.String value)
- Filter the specified string for characters that are sensitive to
HTML interpreters, returning the string with these characters replaced
by the corresponding character entities.
getActionErrors
public org.apache.struts.action.ActionErrors getActionErrors(javax.servlet.jsp.PageContext pageContext, java.lang.String paramName) throws javax.servlet.jsp.JspException
- Deprecated. Use getActionMessages() instead. This will be removed
after Struts 1.2.
- Retrieves the value from request scope and if it isn't already an
ErrorMessagessome classes are converted to one. - Retrieves the value from request scope and if it isn't already an
getActionMappingName
public java.lang.String getActionMappingName(java.lang.String action)
- Return the form action converted into an action mapping path. The
value of the
actionproperty is manipulated as follows in computing the name of the requested mapping:- Any filename extension is removed (on the theory that extension mapping is being used to select the controller servlet).
- If the resulting value does not start with a slash, then a slash is prepended.
getActionMappingURL
public java.lang.String getActionMappingURL(java.lang.String action, javax.servlet.jsp.PageContext pageContext)
- Return the form action converted into a server-relative URL.
getActionMappingURL
public java.lang.String getActionMappingURL(java.lang.String action, java.lang.String module, javax.servlet.jsp.PageContext pageContext, boolean contextRelative)
- Return the form action converted into a server-relative URL.
getActionMessages
public org.apache.struts.action.ActionMessages getActionMessages(javax.servlet.jsp.PageContext pageContext, java.lang.String paramName) throws javax.servlet.jsp.JspException
- Retrieves the value from request scope and if it isn't already an
ActionMessages, some classes are converted to one.
getModuleConfig
public org.apache.struts.config.ModuleConfig getModuleConfig(javax.servlet.jsp.PageContext pageContext)
- Return the ModuleConfig object if it exists, null if otherwise.
getModuleConfig
public org.apache.struts.config.ModuleConfig getModuleConfig(java.lang.String module, javax.servlet.jsp.PageContext pageContext)
- Return the ModuleConfig object for the given prefix if it exists, null if otherwise.
getScope
public int getScope(java.lang.String scopeName) throws javax.servlet.jsp.JspException
- Converts the scope name into its corresponding PageContext constant value.
getUserLocale
public java.util.Locale getUserLocale(javax.servlet.jsp.PageContext pageContext, java.lang.String locale)
- Look up and return current user locale, based on the specified parameters.
isXhtml
public boolean isXhtml(javax.servlet.jsp.PageContext pageContext)
- Returns true if the custom tags are in XHTML mode.
lookup
public java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String scopeName) throws javax.servlet.jsp.JspException
- Locate and return the specified bean, from an optionally specified
scope, in the specified page context. If no such bean is found,
return
nullinstead. If an exception is thrown, it will have already been saved via a call tosaveException().
lookup
public java.lang.Object lookup(javax.servlet.jsp.PageContext pageContext, java.lang.String name, java.lang.String property, java.lang.String scope) throws javax.servlet.jsp.JspException
- Locate and return the specified property of the specified bean, from
an optionally specified scope, in the specified page context. If an
exception is thrown, it will have already been saved via a call to
saveException().
message
public java.lang.String message(javax.servlet.jsp.PageContext pageContext, java.lang.String bundle, java.lang.String locale, java.lang.String key) throws javax.servlet.jsp.JspException
- Look up and return a message string, based on the specified parameters.
message
public java.lang.String message(javax.servlet.jsp.PageContext pageContext, java.lang.String bundle, java.lang.String locale, java.lang.String key, java.lang.Object[] args) throws javax.servlet.jsp.JspException
- Look up and return a message string, based on the specified parameters.
pageURL
public java.lang.String pageURL(javax.servlet.http.HttpServletRequest request, java.lang.String page, org.apache.struts.config.ModuleConfig moduleConfig)
Return the context-relative URL that corresponds to the specified
pageattribute value, calculated based on thepagePatternproperty of the current module's org.apache.struts.config.ModuleConfig.
present
public boolean present(javax.servlet.jsp.PageContext pageContext, java.lang.String bundle, java.lang.String locale, java.lang.String key) throws javax.servlet.jsp.JspException
- Return true if a message string for the specified message key
is present for the specified Locale.
retrieveMessageResources
public org.apache.struts.util.MessageResources retrieveMessageResources(javax.servlet.jsp.PageContext pageContext, java.lang.String bundle, boolean checkPageScope) throws javax.servlet.jsp.JspException
- Returns the appropriate MessageResources object for the current module and
the given bundle.
saveException
public void saveException(javax.servlet.jsp.PageContext pageContext, java.lang.Throwable exception)
- Save the specified exception as a request attribute for later use.
write
public void write(javax.servlet.jsp.PageContext pageContext, java.lang.String text) throws javax.servlet.jsp.JspException
- Write the specified text as the response to the writer associated with
this page. WARNING - If you are writing body content
from the
doAfterBody()method of a custom tag class that implementsBodyTag, you should be callingwritePrevious()instead.
writePrevious
public void writePrevious(javax.servlet.jsp.PageContext pageContext, java.lang.String text) throws javax.servlet.jsp.JspException
- Write the specified text as the response to the writer associated with
the body content for the tag within which we are currently nested.
|
|||||||||
| Home >> All >> org >> apache >> struts >> [ taglib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.struts.taglib.TagUtils