Hi Gerald,

It could be a little bit tricky to use request parameters for
choosing locale.

If you call request.getParameter() before the
LocalePicker#pickCharacterEncoding() method is invoked, the returned
encoding may not be used.
This is why the javadoc of the LocalePicker#pickLocale method
suggests not to use request parameters for choosing locale.

The source reason for this exists in the servlet spec.
Here's an excerpt from the javadoc of the
ServletRequest#setCharacterEncoding():
'This method must be called prior to reading request parameters or
reading input using getReader(). Otherwise, it has no effect.'

--
I would create a custom locale picker which checks a session
attribute to determine locale.
Parsing request parameter and setting the session attribute can be
done in action beans.
You need to return RedirectResolution instead of ForwardResolution
for the locale change to take effect.

Hope this helps,
Iwao

on 09/09/01 17:34 Gerald Fiesser said the following:
> Stripes is very intelligent setting the locale based on information in the
> request or the local configuration.
> I need to do something different. My app gets the locale as a parameter, so
> I need to be able to switch between languages programmatically.
> 
> So far, the only way I see this can be done in Stripes is overriding
> StripesFilter and providing my own doFilter() method to set my own locale.
> 
> Are there better ways to do this? I'm using 1.5.1.
> 
> - Gerald


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to