1

I am currently working on an application that got quite recently ported from JSF 1.2 to JSF 2 (Mojarra 2.1.21 + Seam 2.3).

There is one page that has quite a lot of similar constructs (this isnt exact syntax and I know that ELs would not compile in this form):

<s:fragment rendered="aModel.typeAbc eq 'ABC'">
   <ui:include src="...xhtml"/>
</s:fragment>

<s:fragment rendered="aModel.type123 eq '123'">
   <ui:include src="...xhtml"/>
</s:fragment>

As a result of evaluation of expressions in only 1 page is included. Expressions always use a model (lets call the instance "aModel") to create a boolean expression. The problem is that "aModel" can be an instance of Model class, or any of its subclasses. Going further - any of the expressions can use values (getters) that are only available to a particular instance of sublass:

  • Model has method getType()
  • ModelAbc has method getTypeAbc()
  • Model123 has method getType123()

This leads to a situation when reusing of the same page for displaying details of different type of models will cause all of the to be executed and its contents inserted to the UI Tree.

Then, during State Saving I get PropertyNotFoundException because the current 'aModel' (lets say it is of type Model123) does not have method 'getTypeAbc'.

Edit 1:

The EL Value resolved during state saving is the one used in "ui:repeat".

And now real questions:

  1. Is it a correct solution that has been used here ?
  2. Is it possible to completely disable state saving for 1 particular page ?
  3. Is it possible to programatically clean the state of such Page from the backend side ?
  4. Does JSF2 always save state of not rendered controls ?
  5. Any ideas how to approach this problem ?

Edit 2.

There was already an answer by BalusC (and 2-3 comments), but I cannot see it now. Anyone has deleted it ?! If so, why there is no sign of it ?

Rafal G.
  • 4,252
  • 1
  • 25
  • 41

0 Answers0