Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4126914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:05:43+00:00 2026-05-21T00:05:43+00:00

I got some problems understanding the Conversation scope of Weld or CDI. In my

  • 0

I got some problems understanding the Conversation scope of Weld or CDI.

In my JSF Faclets page i call:

        <f:metadata>
            <f:event type="preRenderView" listener="#{viewBean.start}" />
        </f:metadata>

The bean:

import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
@Named
@ConversationScoped
public class ViewBean implements Serializable {

@Inject
    private Conversation conversation;

public void start() {
    if (conversation.isTransient()) {
        System.out.println("START CONVERSATION");
        conversation.begin();

    }
}

Now every time I refresh my browser, a new Conversation is started. Is that the correct behaviour? So why is the conversation always transient? No exception is thrown. The beans.xml is created and empty:

<beans xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T00:05:43+00:00Added an answer on May 21, 2026 at 12:05 am

    Short answer: Yes, this is the correct behavior.

    Long answer: A conversation represents a “unit of work”, which a such has to be demarcated explicitly. This is done with the explicit call of conversation.begin() – as you are doing already. Should you want to use the same conversation over more than one request, you have to propagate it – this is what you are not doing 🙂

    When you propagate a conversation, a conversation-id is appended to the request. This tells the container which conversation is wanted. When you just hit the refresh button without a conversation-id in your request a new conversation is generated for each request.

    From the documentation:

    The conversation context automatically
    propagates with any JSF faces request
    (JSF form submission) or redirect. It
    does not automatically propagate with
    non-faces requests, for example,
    navigation via a link.

    If you need to propagate it manually, just add the conversation-id to the request:

    <h:link outcome="/addProduct.xhtml" value="Add Product">
       <f:param name="cid" value="#{javax.enterprise.context.conversation.id}"/>
    </h:link>
    

    All that and much more is explained here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just starting with C++ and got some problems in understanding how the
got some problems deploying a java web application on jboss 7.1... Stepped through the
I got some problems with EOF and stdio in a communication pipeline between a
I got some problems with the error Link error LNK2005 ... already defined. The
I've got some problems on a .NET site where both Latin (åäö) and Latvian
i'm new to java and i got some problems. i'm developping a web application
I'm trying to make a appcache file but got some problems... I've added the
I was trying to perform a SQL statement and got some problems with encoding.
I'm a beginner in Java and I have got some problems with the static
I working on my first ASP.net MVC project and and i got some problems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.