Java Doc for TagUtils.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » taglib » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 1.3.8 » org.apache.struts.taglib 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.struts.taglib.TagUtils

TagUtils
public class TagUtils (Code)
Provides helper methods for JSP tags.
version:
   $Rev: 471754 $
since:
   Struts 1.2



Constructor Summary
protected  TagUtils()
     Constructor for TagUtils.

Method Summary
public  MapcomputeParameters(PageContext pageContext, String paramId, String paramName, String paramProperty, String paramScope, String name, String property, String scope, boolean transaction)
     Compute a set of query parameters that will be dynamically added to a generated URL.
public  StringcomputeURL(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect)
    
public  StringcomputeURL(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect, boolean encodeSeparator)
    
public  StringcomputeURLWithCharEncoding(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect, boolean useLocalEncoding)
     Compute a hyperlink URL based on the forward, href, action or page parameter that is not null.
public  StringcomputeURLWithCharEncoding(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, 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.
public  StringencodeURL(String url)
     URLencodes a string assuming the character encoding is UTF-8.
public  StringencodeURL(String url, String enc)
     Use the new URLEncoder.encode() method from Java 1.4 if available, else use the old deprecated version.
public  Stringfilter(String value)
     Filter the specified string for characters that are senstive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
public  StringgetActionMappingName(String action)
     Return the form action converted into an action mapping path.
public  StringgetActionMappingURL(String action, PageContext pageContext)
     Return the form action converted into a server-relative URL.
public  StringgetActionMappingURL(String action, String module, PageContext pageContext, boolean contextRelative)
     Return the form action converted into a server-relative URL.
public  ActionMessagesgetActionMessages(PageContext pageContext, String paramName)
     Retrieves the value from request scope and if it isn't already an ActionMessages, some classes are converted to one.
public static  TagUtilsgetInstance()
     Returns the Singleton instance of TagUtils.
public  ModuleConfiggetModuleConfig(PageContext pageContext)
     Return the default ModuleConfig object if it exists, null if otherwise.
Parameters:
  pageContext - The page context.
public  ModuleConfiggetModuleConfig(String module, PageContext pageContext)
     Return the specified ModuleConfig object for the given prefix if it exists, otherwise a NullPointerException will be thrown.
Parameters:
  module - The module prefix
Parameters:
  pageContext - The page context.
public  intgetScope(String scopeName)
     Converts the scope name into its corresponding PageContext constant value.
Parameters:
  scopeName - Can be "page", "request", "session", or "application"in any case.
public  LocalegetUserLocale(PageContext pageContext, String locale)
     Look up and return current user locale, based on the specified parameters.
Parameters:
  pageContext - The PageContext associated with this request
Parameters:
  locale - Name of the session attribute for our user's Locale.If this is null, the default locale keyis used for the lookup.
public  booleanisXhtml(PageContext pageContext)
     Returns true if the custom tags are in XHTML mode.
public  Objectlookup(PageContext pageContext, String name, String scopeName)
     Locate and return the specified bean, from an optionally specified scope, in the specified page context.
public  Objectlookup(PageContext pageContext, String name, String property, String scope)
     Locate and return the specified property of the specified bean, from an optionally specified scope, in the specified page context.
public  Stringmessage(PageContext pageContext, String bundle, String locale, String key)
     Look up and return a message string, based on the specified parameters.
public  Stringmessage(PageContext pageContext, String bundle, String locale, String key, Object[] args)
     Look up and return a message string, based on the specified parameters.
public  StringpageURL(HttpServletRequest request, String page, ModuleConfig moduleConfig)
    
public  booleanpresent(PageContext pageContext, String bundle, String locale, String key)
     Return true if a message string for the specified message key is present for the specified Locale and bundle.
public  MessageResourcesretrieveMessageResources(PageContext pageContext, String bundle, boolean checkPageScope)
     Returns the appropriate MessageResources object for the current module and the given bundle.
Parameters:
  pageContext - Search the context's scopes for the resources.
Parameters:
  bundle - The bundle name to look for.
public  voidsaveException(PageContext pageContext, Throwable exception)
     Save the specified exception as a request attribute for later use.
public static  voidsetInstance(TagUtils instance)
     Set the instance.
public  voidwrite(PageContext pageContext, String text)
     Write the specified text as the response to the writer associated with this page.
public  voidwritePrevious(PageContext pageContext, 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.


Constructor Detail
TagUtils
protected TagUtils()(Code)
Constructor for TagUtils.




Method Detail
computeParameters
public Map computeParameters(PageContext pageContext, String paramId, String paramName, String paramProperty, String paramScope, String name, String property, String scope, boolean transaction) throws JspException(Code)
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, return null.
Parameters:
  pageContext - PageContext we are operating in
Parameters:
  paramId - Single-value request parameter name (if any)
Parameters:
  paramName - Bean containing single-value parameter value
Parameters:
  paramProperty - Property (of bean named by paramNamecontaining single-value parameter value
Parameters:
  paramScope - Scope containing bean named by paramName
Parameters:
  name - Bean containing multi-value parameters Map (ifany)
Parameters:
  property - Property (of bean named by namecontaining multi-value parameters Map
Parameters:
  scope - Scope containing bean named by name
Parameters:
  transaction - Should we add our transaction control token? Map of query parameters
throws:
  JspException - if we cannot look up the required beans
throws:
  JspException - if a class cast exception occurs on a looked-upbean or property



computeURL
public String computeURL(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect) throws MalformedURLException(Code)



computeURL
public String computeURL(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect, boolean encodeSeparator) throws MalformedURLException(Code)



computeURLWithCharEncoding
public String computeURLWithCharEncoding(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect, boolean useLocalEncoding) throws MalformedURLException(Code)
Compute a hyperlink URL based on the forward, href, action or page parameter that is not null. The returned URL will have already been passed to response.encodeURL() for adding a session identifier.
Parameters:
  pageContext - PageContext for the tag making this call
Parameters:
  forward - Logical forward name for which to look up thecontext-relative URI (if specified)
Parameters:
  href - URL to be utilized unmodified (if specified)
Parameters:
  page - Module-relative page for which a URL should becreated (if specified)
Parameters:
  action - Logical action name for which to look up thecontext-relative URI (if specified)
Parameters:
  params - Map of parameters to be dynamically included (ifany)
Parameters:
  anchor - Anchor to be dynamically included (if any)
Parameters:
  redirect - Is this URL for a response.sendRedirect()? URL with session identifier
throws:
  java.net.MalformedURLException - if a URL cannot be created forthe specified parameters



computeURLWithCharEncoding
public String computeURLWithCharEncoding(PageContext pageContext, String forward, String href, String page, String action, String module, Map params, String anchor, boolean redirect, boolean encodeSeparator, boolean useLocalEncoding) throws MalformedURLException(Code)
Compute a hyperlink URL based on the forward, href, action or page parameter that is not null. The returned URL will have already been passed to response.encodeURL() for adding a session identifier.
Parameters:
  pageContext - PageContext for the tag making this call
Parameters:
  forward - Logical forward name for which to look up thecontext-relative URI (if specified)
Parameters:
  href - URL to be utilized unmodified (if specified)
Parameters:
  page - Module-relative page for which a URL should becreated (if specified)
Parameters:
  action - Logical action name for which to look up thecontext-relative URI (if specified)
Parameters:
  params - Map of parameters to be dynamically included(if any)
Parameters:
  anchor - Anchor to be dynamically included (if any)
Parameters:
  redirect - Is this URL for a response.sendRedirect()?
Parameters:
  encodeSeparator - This is only checked if redirect is set tofalse (never encoded for a redirect). If true,query string parameter separators are encodedas >amp;, else & is used.
Parameters:
  useLocalEncoding - If set to true, urlencoding is done on thebytes of character encoding fromServletResponse#getCharacterEncoding. Use UTF-8otherwise. URL with session identifier
throws:
  java.net.MalformedURLException - if a URL cannot be created forthe specified parameters



encodeURL
public String encodeURL(String url)(Code)
URLencodes a string assuming the character encoding is UTF-8.
Parameters:
  url - String The encoded url in UTF-8



encodeURL
public String encodeURL(String url, String enc)(Code)
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.
Parameters:
  enc - The character encoding the urlencode is performed on. String The encoded url.



filter
public String filter(String value)(Code)
Filter the specified string for characters that are senstive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
Parameters:
  value - The string to be filtered and returned



getActionMappingName
public String getActionMappingName(String action)(Code)
Return the form action converted into an action mapping path. The value of the action property 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 String getActionMappingURL(String action, PageContext pageContext)(Code)
Return the form action converted into a server-relative URL.



getActionMappingURL
public String getActionMappingURL(String action, String module, PageContext pageContext, boolean contextRelative)(Code)
Return the form action converted into a server-relative URL.



getActionMessages
public ActionMessages getActionMessages(PageContext pageContext, String paramName) throws JspException(Code)
Retrieves the value from request scope and if it isn't already an ActionMessages, some classes are converted to one.
Parameters:
  pageContext - The PageContext for the current page
Parameters:
  paramName - Key for parameter value ActionErrors in page context.
throws:
  JspException -



getInstance
public static TagUtils getInstance()(Code)
Returns the Singleton instance of TagUtils.



getModuleConfig
public ModuleConfig getModuleConfig(PageContext pageContext)(Code)
Return the default ModuleConfig object if it exists, null if otherwise.
Parameters:
  pageContext - The page context. the ModuleConfig object



getModuleConfig
public ModuleConfig getModuleConfig(String module, PageContext pageContext)(Code)
Return the specified ModuleConfig object for the given prefix if it exists, otherwise a NullPointerException will be thrown.
Parameters:
  module - The module prefix
Parameters:
  pageContext - The page context. the ModuleConfig object
throws:
  NullPointerException - Thrown when module cannot be found



getScope
public int getScope(String scopeName) throws JspException(Code)
Converts the scope name into its corresponding PageContext constant value.
Parameters:
  scopeName - Can be "page", "request", "session", or "application"in any case. The constant representing the scope (ie. PageContext.REQUEST_SCOPE).
throws:
  JspException - if the scopeName is not a valid name.



getUserLocale
public Locale getUserLocale(PageContext pageContext, String locale)(Code)
Look up and return current user locale, based on the specified parameters.
Parameters:
  pageContext - The PageContext associated with this request
Parameters:
  locale - Name of the session attribute for our user's Locale.If this is null, the default locale keyis used for the lookup. current user locale



isXhtml
public boolean isXhtml(PageContext pageContext)(Code)
Returns true if the custom tags are in XHTML mode.



lookup
public Object lookup(PageContext pageContext, String name, String scopeName) throws JspException(Code)
Locate and return the specified bean, from an optionally specified scope, in the specified page context. If no such bean is found, return null instead. If an exception is thrown, it will have already been saved via a call to saveException().
Parameters:
  pageContext - Page context to be searched
Parameters:
  name - Name of the bean to be retrieved
Parameters:
  scopeName - Scope to be searched (page, request, session,application) or null to usefindAttribute() instead JavaBean in the specified page context
throws:
  JspException - if an invalid scope name is requested



lookup
public Object lookup(PageContext pageContext, String name, String property, String scope) throws JspException(Code)
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().
Parameters:
  pageContext - Page context to be searched
Parameters:
  name - Name of the bean to be retrieved
Parameters:
  property - Name of the property to be retrieved, ornull to retrieve the bean itself
Parameters:
  scope - Scope to be searched (page, request, session,application) or null to usefindAttribute() instead property of specified JavaBean
throws:
  JspException - if an invalid scope name is requested
throws:
  JspException - if the specified bean is not found
throws:
  JspException - if accessing this property causes anIllegalAccessException, IllegalArgumentException,InvocationTargetException, or NoSuchMethodException



message
public String message(PageContext pageContext, String bundle, String locale, String key) throws JspException(Code)
Look up and return a message string, based on the specified parameters.
Parameters:
  pageContext - The PageContext associated with this request
Parameters:
  bundle - Name of the servlet context attribute for ourmessage resources bundle
Parameters:
  locale - Name of the session attribute for our user's Locale
Parameters:
  key - Message key to be looked up and returned message string
throws:
  JspException - if a lookup error occurs (will have been saved inthe request already)



message
public String message(PageContext pageContext, String bundle, String locale, String key, Object[] args) throws JspException(Code)
Look up and return a message string, based on the specified parameters.
Parameters:
  pageContext - The PageContext associated with this request
Parameters:
  bundle - Name of the servlet context attribute for ourmessage resources bundle
Parameters:
  locale - Name of the session attribute for our user's Locale
Parameters:
  key - Message key to be looked up and returned
Parameters:
  args - Replacement parameters for this message message string
throws:
  JspException - if a lookup error occurs (will have been saved inthe request already)



pageURL
public String pageURL(HttpServletRequest request, String page, ModuleConfig moduleConfig)(Code)

Return the context-relative URL that corresponds to the specified page attribute value, calculated based on the pagePattern property of the current module's ModuleConfig .


Parameters:
  request - The servlet request we are processing
Parameters:
  page - The module-relative URL to be substituted in to thepagePattern pattern for the current module(MUST start with a slash) context-relative URL



present
public boolean present(PageContext pageContext, String bundle, String locale, String key) throws JspException(Code)
Return true if a message string for the specified message key is present for the specified Locale and bundle.
Parameters:
  pageContext - The PageContext associated with this request
Parameters:
  bundle - Name of the servlet context attribute for ourmessage resources bundle
Parameters:
  locale - Name of the session attribute for our user's Locale
Parameters:
  key - Message key to be looked up and returned true if a message string for message key exists
throws:
  JspException - if a lookup error occurs (will have been saved inthe request already)



retrieveMessageResources
public MessageResources retrieveMessageResources(PageContext pageContext, String bundle, boolean checkPageScope) throws JspException(Code)
Returns the appropriate MessageResources object for the current module and the given bundle.
Parameters:
  pageContext - Search the context's scopes for the resources.
Parameters:
  bundle - The bundle name to look for. If this isnull, the default bundle name isused.
Parameters:
  checkPageScope - Whether to check page scope MessageResources The bundle's resources stored in some scope.
throws:
  JspException - if the MessageResources object could not befound.



saveException
public void saveException(PageContext pageContext, Throwable exception)(Code)
Save the specified exception as a request attribute for later use.
Parameters:
  pageContext - The PageContext for the current page
Parameters:
  exception - The exception to be saved



setInstance
public static void setInstance(TagUtils instance)(Code)
Set the instance. This blatently violates the Singleton pattern, but then some say Singletons are an anti-pattern.
since:
   1.3.5 Changed to non-final and added setInstance() so TagUtils may be overridden, use at your own risk (you've been warned!!)
Parameters:
  instance - The instance to set.



write
public void write(PageContext pageContext, String text) throws JspException(Code)
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 implements BodyTag, you should be calling writePrevious() instead.
Parameters:
  pageContext - The PageContext object for this page
Parameters:
  text - The text to be written
throws:
  JspException - if an input/output error occurs (already saved)



writePrevious
public void writePrevious(PageContext pageContext, String text) throws JspException(Code)
Write the specified text as the response to the writer associated with the body content for the tag within which we are currently nested.
Parameters:
  pageContext - The PageContext object for this page
Parameters:
  text - The text to be written
throws:
  JspException - if an input/output error occurs (already saved)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.