Long story short, I am experimenting on migrating to MyFaces on an application I am working on, when I noticed that the ViewState was over 18MB in size for a single page. I suspect this is because I have over 10 forms on this page, which is necessary because the page has over 10 ajaxified PrimeFaces dialogs and Ajax dialogs require their own internal form. It seems like the ViewState grows exponentially with each form. I read that MyFaces is far superior in efficiency with regards to ViewState so I am attempting to prototype my application to profile the results.
I notice a particular use case that was never a problem with Mojarra:
- I have a PrimeFaces data table
- Click an Edit button on a row
- The selected row is updated to the model
- I render the Edit Dialog's form to display the managed bean value of the selected row
- The Edit button
oncomplete
attribute executes a script that displays the dialog. - Normal LOB data entry form where user Submits form
- Persist to DB
- Ajax render the data table with the new values for that record
The issue with MyFaces seems to be that it is more picky with the EL expressions by throwing a NullPointerException on the data table selected value if it happens to be null. This never occurred (for right or wrong) with Mojarra. Eg.
<h:form>
<p:dataTable var="bla" selection="#{managedBean.selectedValue}" ...>
<p:column header="Options">
<p:commandButton ajax="true" value="Edit" process="@this" update=":editDialogForm"
oncomplete="editDialogWidget.show()" />
</p:column>
...
</p:dataTable>
</h:form>
....
<p:dialog widgetVar="editDialogWidget" header="Edit stuff" ...>
<h:form id="editDialogForm">
<h:inputText value="#{managedBean.selectedValue.someHibernateProperty}" />
...
</h:form>
</p:dialog>
You can clearly see where this would result in an NPE, but I was wondering if there is a context parameter that can be used in MyFaces so that it will behave like Mojarra in this respect with EL expressions? If not then is this a bug with Mojarra to where this should have never worked at all?