0 Replies Latest reply on Jul 24, 2011 2:21 PM by wangliyu

    CDI conversation propagation doesn't work with JSF2 ajax mulit-form

    wangliyu
      In case you have the same problem with me, here is what happened:
      CDI conversation propagation requires to add "?cid={actual LRC id}" into the form target so that it can be bring back and active the right conversation context (see weld core's jsf package), this is OK for normal POST/GET or POST-redirect-GET, even single form ajax call, but JSF2 spec has a bug, it won't carry the viewState back to all the form if the ajax call try to render mulitple forms, so here is the delima:
      I have several forms on the same page, for ajax calls, even I want to just refresh one form, I need carry the cid to all the forms, and if I refresh all forms, the cid is right but the viewState is missing, so when I try to submit other forms next time, the JSF will skip phase 2 to 5 because it think that I'm just do a non-face request.

      The JSF2 team seems won't fix this problem any time soon (it's lame), and I understand the approach why CDI requires carry back cid (so that CDI can support multiple conversations in the same session, but I'm wondering how many people really change the cid everytime?), but I think CDI should have a more sophisticate approach, for example:

      before the phase 1(restore view), if the cid is in the request parameter map, use it to activate context, if it's not in there and user does have a LRC, try use latest LRC cid, if there is no LRC, then create a temp conversation.

      any thought on this?