문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top