Reputation: 493
I'm trying to use CDI conversation scope and I have some doubts: - Do I need to propagate cdi id when use ajax request?
For example:
<p:spinner value='#' min="1" max="99" styleClass="spinerqtde" title="Quantidade" stepFactor="1" maxlength="2">
<f:param name="cid" value="#{carrinho.conversation.id}"></f:param>
<p:ajax update="@form" listener='#{carrinho.lstSpinerProduto}' process="@this" />
</p:spinner>
Because when I don't, I realized that the method "@postConstruct" is initialized again, and is created a new CID.
ManagedBean code:
@Named("carrinho")
@ConversationScoped
public class CCarrinho implements Serializable
{
.
.
.
@Inject
private Conversation conversation;
.
.
.
@PostConstruct
public void inicializar()
{
if (getConversation().isTransient())
{
getConversation().begin();
}
}
Thanks. Bye!
Upvotes: 1
Views: 1283
Reputation: 4752
The id of the current conversation is kept in the current view and when you perform a post back (the ajax request is also a postback) the conversation id is there so there is no need for you to provide it.
Upvotes: 1