natural conversations: take care of cid-name!
mars1412 Feb 27, 2008 6:08 PMmake sure, that you do not have any hidden form field in your page, with the same name as your natural conversation id!
This happened to me today:
For the user registration process, I want to use one single conversation: so I use a natural conversation for this.
pages.xml
<conversation name="Conv_Registration" parameter-name="registration" parameter-value="register"/>
I chose the cid-name registration and the fixed value register
- so the same conversation will be reused everytime the user clicks on the registration link.
this worked for the first 3 pages of the registration form, but the last page always redirected to the first page (on form submission, on ajax calls, ..)
I learned from the docfiles, that no active conversation existed and due to my navigation rules, I have been redirected to the first page:
conversation-required="true" no-conversation-view-id="/reg_page1.xhmtl">
after some time (in fact a lot of time), I think I found the reason:
on the last page, there was a h:form element with id=registration
. Because of this, a hidden formfield with name=registration
and value=registration
has been added to my page.
now when the form was submitted (also via ajax-call), there was a clash between the seam conversation id named registration
and the hidden jsf-form field, also named registration
.
seems, like the form field won and seam got the conversation name registration
and the conversation value registration
, which did not match the value of my natural conversation register
(specified in pages.xml): thus, the conversation registration
did not exist, and due to the navigation rules, I was redirected to the first page.
the first page now reused the existing correct conversation named ConvRegistration:register, but in the seam debug page I also see, that a second conversation named ConvRegistration:registration has been created.
conclusion of all that:
in the future, I will use names, like cid_XXX for all my natural conversations and forbidd those names for other identifiers
<conversation name="Conv_Registration" parameter-name="cid_registration" parameter-value="register_cid"/>