Cant execute actions with conditionally rendered buttons - Primefaces, JSF and Spring Session

Components, Ajax Framework, Utilities and More.
Post Reply
joaocarlos86
Posts: 3
Joined: 18 Apr 2017, 23:58

19 Apr 2017, 00:12

Versions:

Primefaces 6.0
JSF (myfaces) 2.2.12
spring-session 1.3.0.RELEASE
spring-session-data-redis 1.3.0.RELEASE
lettuce 3.5.0.FINAL

I'm having issues using the HttpSession (SpringSession - redis) to clusterize the session of my users. The issue behavior is very specific, but, to me, looks like the ViewState is not being recovered correctly.

In a page I have a button (primefaces, ajax), when I click this button it triggers a action in my managed bean and a dialog is show with a text derived by the action executed in my managed bean.
But, if I have a button that is dynamically rendered (rendered="#{someBean.someBooleanProperty}"), when a action renders this button, the button doesn't trigger any action in my managed bean.

After debugging the execution stack of JSF, I've seen that the dynamically generated button action triggers the JSF lifecycle, but the action never reaches the ManagedBean.

Everything works fine if I remove spring session.

I'm providing a sample application proving the issue. (at https://github.com/joaocarlos86/spring-session-problem).

Thanks in advance.

tandraschko
PrimeFaces Core Developer
Posts: 3154
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

19 Apr 2017, 14:57

Did you try to set javax.faces.SERIALIZE_SERVER_STATE? I would disable view state encryption for testing. Just check the myfaces documentation and availabe web.xml parameters.

This is not related to PrimeFaces.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

joaocarlos86
Posts: 3
Joined: 18 Apr 2017, 23:58

19 Apr 2017, 17:11

Hi, thanks for your reply.

I've tried configuring the following parameters:

org.apache.myfaces.COMPRESS_STATE_IN_SESSION
javax.faces.PARTIAL_STATE_SAVING
org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
org.apache.myfaces.USE_ENCRYPTION
javax.faces.STATE_SAVING_METHOD

but the result seems the same. Also, I tried to change the JSF implementation, from MyFaces to Mojara, and the bug persists.
I also tried to change the state saving from client to server, but, no success here...
I've tried to debug the JSF lifecycle, but I cant get into the primefaces stuff (if I remove the spring session, everything works fine).
I've compared the posts of both buttons (using firebug) and they are very similar, only the IDs of the components change.

Any suggestion?

tandraschko
PrimeFaces Core Developer
Posts: 3154
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

19 Apr 2017, 17:40

First of all, i'm sure it will be the same with h:commandButton instead p:commandButton. So it would be better to use e.g. stackoverflow or the jsf impl guys.

The following should work fine from the viewstate aspect:
javax.faces.STATE_SAVING_METHOD = session
javax.faces.PARTIAL_STATE_SAVING = true
org.apache.myfaces.SERIALIZE_STATE_IN_SESSION = true
org.apache.myfaces.USE_ENCRYPTION = false
org.apache.myfaces.COMPRESS_STATE_IN_SESSION = false

I would try if this is working without spring session stuff BUT e.g. on a clustered tomcat.
It also depends on your beans and bean scopes. It must be saved to the session, too. E.g. in older OWB versions you have to enable bean failover.

Maybe there is something in the logs or you need to debug the jsf impl.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

joaocarlos86
Posts: 3
Joined: 18 Apr 2017, 23:58

19 Apr 2017, 19:14

Hi, first of all, thanks for your message.

Using the parameters configuration provided, the case still not working, but, your affirmation is true, the problem still occur when i switched the components back to h:commandButton and f:ajax, so, this is not a primefaces issue.

I will try to find out more info.

Thanks for your time.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Yahoo [Bot] and 13 guests