myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeanne Waldman <jeanne.wald...@oracle.com>
Subject [TRINIDAD] central way to specify locale proposal
Date Thu, 12 Mar 2009 22:27:46 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
I've been thinking about how to set the locale in a central way <br>
&nbsp;and also we recently found an 'issue' with
&lt;f:view locale="xx_yy"&gt;<br>
<br>
According to the JSF spec, there are two ways one can override view
locale. <br>
(a) provide a custom ViewHandler <br>
(b) specify in each page &lt;f:view locale="xx_yy"&gt; <br>
<br>
(a) may not be a preferred approach, due to the fact that ViewHandler&nbsp;
also controls a number <br>
of other behaviors of Faces, and
Trinidad's ViewHandler
is private. <br>
(b) This approach requires specification of locale/EL in each page.&nbsp;<strike></strike><font
 color="#330033">This is both labor
intensive and the values chosen are<br>
&nbsp;likely to conflict with the
locale-related configuration properties in trinidad-config, e.g.,
formatting-locale, time-zone,etc.</font>&nbsp;
<br>
Also for (b) we have encountered an 'issue'. I won't
call it a bug because it appears <br>
this is how it is spec'd to work. <br>
<br>
Our framework is trying to obey the page author's intended locale for
servlet operations <i>before </i>render response. <br>
Unfortunately the locale on &lt;f:view&gt; does not get set until
render response.<br>
<br>
The issue is that the JSF specification is confusing with regards to
what the createView phase actually does.&nbsp; <br>
Logically you'd think after createView the entire component tree has
been created and that renderResponse renders this component tree.&nbsp; <br>
However, the JSP ViewHandler doesn't work that way (presumably because
JSP execution is designed only to render).&nbsp; <br>
Instead, the createView phase of the JSP ViewHandler only creates the
UIViewRoot&nbsp; and creating the rest of the <br>
component tree is not executed until the RenderResponse phase. This is
too late for our framework.&nbsp; &nbsp;<br>
<br>
WORKAROUNDS:<br>
1. PhaseListener - the application developer can create a PhaseListener
during RESTORE_VIEW <br>
and this can set the locale onto the UIView roow. The locale could come
from a managed bean, for example.<br>
This requires the app developer to write clode. <br>
<br>
2. Trinidad can add a &lt;default-locale&gt; element to
trinidad-config.xml. This is a declarative approach.<br>
<br>
The logic can be:<br>
<br>
a. use &lt;default-locale&gt; in trinidad-config.xml if specified<br>
b. override with &lt;f:view locale&gt; if set (this won't be until
render response)<br>
<br>
What do people think about this?<br>
<br>
Thanks, <br>
Jeanne
</body>
</html>

Mime
View raw message