Should the <f:view> tag go outside (around) the <rich:page> tag? Or inside it?

Note that I do want to have an <f:view> tag, as I want to set the locale.

有帮助吗?

解决方案

The <f:view> runs as being a taghandler during view build time, setting the specified attributes as properties of the current UIViewRoot and/or the HttpServletResponse instance.

So, if some taghandler (not UI component!) is encountered before the <f:view> and relies on one of those attributes, then it will miss hit. However, <rich:page> is an UI component which runs during view render time which is long after view build time, so it will guaranteed have access to the right attribute values, even if it appears before the <f:view> in the tree.

In any case, even though it's merely a "metadata" tag (it can be placed anywhere in the view, even duplicated/nested), most self-documenting is to just put the <f:view> as outermost tag of the tree.

See also:

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top