0

I remember in JSF 2.1 the <ui:include> was a taghandler, as such, it was evaluated once when the component tree was built. When the src attribute changed before rendering, the page was always rendered using the previous value.

<h:form>
  <h:inputText value="#{sessionScope['includedPage']}" />
  <h:commandButton />
</h:form>

<!-- src should be evaluated before applying values to model phase -->
<ui:include src="#{sessionScope['includedPage']}" />

However with WildFly, the above example just works, the rendered page always include based on the most recent value of includedPage. Why is that? Or do I remember wrong? I didn't find anything in the JSF 2.2 spec regarding this change...

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Did you read this: http://stackoverflow.com/questions/16170519/uiinclude-with-dynamic-src-complete-madness and http://balusc.blogspot.de/2011/09/communication-in-jsf-20.html#ViewScopedFailsInTagHandlers . Oh wait, you used sessionScoped beans. Hmmm, then I don't know. – Kukeltje Jun 21 '15 at 13:30
  • I am aware, that it is evaluated view build time. I would expect, that ui:include would include always the previous value of includedPage, becaue the request values were not applied yet. But in fact it does include based on the new value of the includedPage, no matter which scope I store the value. As I can see it on the rendered page. – illEatYourPuppies Jun 21 '15 at 13:38
  • I understood all the things you are aware of. But if you used Viewscoped beans, one thing did change. That is what is mentioned in the links. But you use sessionscoped (did you also with 2.1?) – Kukeltje Jun 21 '15 at 14:27
  • Different potential caveats are mentioned in this related Q&A: http://stackoverflow.com/questions/7108668/how-to-ajax-refresh-dynamic-include-content-by-navigation-menu Is that acceptable as duplicate? – BalusC Jun 22 '15 at 09:12
  • So was it never the case that ui:include is evaluated only once, when viewtree is built? Restoring the view happens before applying request values, so how come, ui:include considers the newest value of 'includedPage' in this example? – illEatYourPuppies Jun 22 '15 at 12:01

0 Answers0