-
1. Richfaces 4.0 datatable filtering
ilya_shaikovsky Mar 23, 2011 7:30 AM (in response to psini82)The proble is that i can't enable PARTIAL_STATE_SAVING because of a bug in the jsf 2.0 .
whic one? maybe you could downgrade JSF 2 itself to some version where there is no such issue?
-
2. Richfaces 4.0 datatable filtering
psini82 Mar 23, 2011 8:04 AM (in response to ilya_shaikovsky)I have not tried but if i set the partial state to true if i try to render with ajax two combo from the second form in a second form i obtain a satcktrace
Caused by: java.lang.ClassCastException: javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;
13:00:43,609 ERROR [STDERR] at org.ajax4jsf.component.behavior.AjaxBehavior.restoreState(AjaxBehavior.java:342)
if i disable the partail state is all ok i have tried the jsf2 version : 2.0.3, 2.0.4,2.1.0
if you want me to try another version ask and i will try.
-
3. Re: Richfaces 4.0 datatable filtering
psini82 Mar 23, 2011 8:47 AM (in response to psini82)The Exception in the case of PARTIAL STATE =true i resolved hacking the class org.ajax4jsf.component.behavior.AjaxBehavior changing the method
@Override public void restoreState(FacesContext context, Object state) { if (state != null) { Object[] values =null; if(state instanceof Object[]){ values= (Object[]) state; }else{ try { Field privateStringField = state.getClass(). getDeclaredField("savedState"); privateStringField.setAccessible(true); values = (Object[]) privateStringField.get(state); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } super.restoreState(context, values[0]); if (values.length != 1) { execute = restoreSet(PropertyKeys.execute, values[1]); render = restoreSet(PropertyKeys.render, values[2]); clearInitialState(); } } }
I know that this is not a patch but i'm wondering why the method in this way have the correct behavior. I had to use the reflection because the class javax.faces.component.StateHolderSaver is private.
Can someone help me to write a patch that resolve this issue?
-
4. Richfaces 4.0 datatable filtering
nbelaevski Mar 23, 2011 9:23 AM (in response to psini82)Hi,
Are you using MyFaces?
-
5. Re: Richfaces 4.0 datatable filtering
psini82 Mar 23, 2011 9:48 AM (in response to nbelaevski)No i'm using Mojarra
-
6. Re: Richfaces 4.0 datatable filtering
nbelaevski Mar 23, 2011 9:50 AM (in response to psini82)Can you please provide page/beans code to reproduce the problem?
-
7. Re: Richfaces 4.0 datatable filtering
psini82 Mar 23, 2011 9:58 AM (in response to nbelaevski)I will try , but for the proble, of filter in a datatable i simple get the showcase demo and punt in the web.xml
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
and test the datatable filtering, for the ClassCastException i will post the test case.