Package org.apache.struts.extras.actions
Class LocaleAction
java.lang.Object
org.apache.struts.action.Action
org.apache.struts.extras.actions.BaseAction
org.apache.struts.extras.actions.LocaleAction
- All Implemented Interfaces:
Serializable
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).- See Also:
-
Field Summary
Fields inherited from class org.apache.struts.extras.actions.BaseAction
messages
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) Change the user'sLocale
based onActionForm
properties.Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
-
Constructor Details
-
LocaleAction
public LocaleAction()
-
-
Method Details
-
execute
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception Change the user's
Locale
based onActionForm
properties.This
Action
looks forlanguage
andcountry
properties on the given form, constructs an appropriate Locale object, and sets it as the Struts Locale for this user's session. AnyActionForm
, including aDynaActionForm
, 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 classAction
- Parameters:
mapping
- The ActionMapping used to select this instanceform
- The optional ActionForm bean for this request (if any)request
- The HTTP request we are processingresponse
- The HTTP response we are creating- Returns:
- Action to forward to
- Throws:
Exception
- if an input/output error or servlet exception occurs
-