Apache Struts API Documentation: Class LocaleAction

Apache Struts API


org.apache.struts.actions Class LocaleAction

java.lang.Object
  |
  +--org.apache.struts.action.Action
        |
        +--org.apache.struts.actions.LocaleAction

public final class LocaleAction
extends Action

Implementation of Action that changes the user's Locale and forwards to a page, based on request level parameters that are set (language, country, & page).


Field Summary
private  org.apache.commons.logging.Log log
          Commons Logging instance.
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet, token
 
Constructor Summary
LocaleAction()
           
 
Method Summary
 ActionForward execute(ActionMapping mapping, ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           Change the user's Locale based on ActionForm properties.
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log
Commons Logging instance.
Constructor Detail

LocaleAction

public LocaleAction()
Method Detail

execute

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws java.lang.Exception

Change the user's Locale based on ActionForm properties.

This Action looks for language and country properties on the given form, constructs an appropriate Locale object, and sets it as the Struts Locale for this user's session. Any ActionForm, including a DynaActionForm, may be used.

If a page property is also provided, then after setting the Locale, control is forwarded to that URI path. Otherwise, control is forwarded to "success".

Overrides:
execute in class Action
Parameters:
mapping - The ActionMapping used to select this instance
form - The optional ActionForm bean for this request (if any)
request - The HTTP request we are processing
response - The HTTP response we are creating
Returns:
Action to forward to
Throws:
java.lang.Exception - if an input/output error or servlet exception occurs


Copyright © 2000-2005 - The Apache Software Foundation