com.ora.jsp.tags.generic
Class UseLocaleBundleTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--com.ora.jsp.tags.generic.UseLocaleBundleTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.Tag

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

This class implements a custom action that creates a com.ora.jsp.beans.locale.LocaleBean and saves it in the session scope.

Version:
1.0
Author:
Hans Bergsten, Gefion software
See Also:
Serialized Form

Field Summary
private  java.lang.String bundleName
           
private  java.lang.String id
           
private  java.lang.String supportedLangs
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext, parent, values
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
UseLocaleBundleTag()
           
 
Method Summary
 int doEndTag()
          Creates and initializes a LocaleBean and saves it in the session scope using the name specified by the "id" property.
private  java.util.Hashtable getParameters(javax.servlet.http.HttpServletRequest request)
          Returns a Hashtable with all HTTP parameters from an HttpServetRequest.
 void release()
          Releases all instance variables.
 void setBundleName(java.lang.String bundleName)
          Sets the bundleName property, i.e.
 void setId(java.lang.String id)
          Sets the id property, i.e.
 void setSupportedLangs(java.lang.String supportedLangs)
          Sets the supportedLangs property, i.e.
private  java.util.Locale[] toArray(java.util.Enumeration locales)
          Converts an Enumeration of Locale objects to a Locale array.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

id

private java.lang.String id

bundleName

private java.lang.String bundleName

supportedLangs

private java.lang.String supportedLangs
Constructor Detail

UseLocaleBundleTag

public UseLocaleBundleTag()
Method Detail

setId

public void setId(java.lang.String id)
Sets the id property, i.e. the name to use for the LocaleBean in the session scope.
Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport
Parameters:
id - the id for the LocaleBean

setBundleName

public void setBundleName(java.lang.String bundleName)
Sets the bundleName property, i.e. the base name for the ResourceBundle used for localized text.
Parameters:
bundleName - the ResourceBundle base name

setSupportedLangs

public void setSupportedLangs(java.lang.String supportedLangs)
Sets the supportedLangs property, i.e. a comma separated list of language/country codes.
Parameters:
supportedLangs - the list of language/country codes

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Creates and initializes a LocaleBean and saves it in the session scope using the name specified by the "id" property.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport

release

public void release()
Releases all instance variables.
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport

toArray

private java.util.Locale[] toArray(java.util.Enumeration locales)
Converts an Enumeration of Locale objects to a Locale array.
Parameters:
locales - Enumeration of Locale objects
Returns:
a Locale[]

getParameters

private java.util.Hashtable getParameters(javax.servlet.http.HttpServletRequest request)
Returns a Hashtable with all HTTP parameters from an HttpServetRequest. The key in the Hashtable is the parameter name and the value is a String[].
Parameters:
request - the HttpServletRequest
Returns:
a Hashtable with all parameters