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 7084479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:18:24+00:00 2026-05-28T07:18:24+00:00

Two days ago I wrote this question: How can I retrieve an object on

  • 0

Two days ago I wrote this question:
How can I retrieve an object on @WindowScoped?
and BalusC answered with some suggestions, now I have some problem to understand if my problem is that the object in WindowScoped is stored properly or my code to retrieve it is wrong!

Well, as I said, I have an object that I stored in @WindowScoped annotation but I can retrive this object only the first time! Why?

I just have a doubt: the CODI extension of MyFaces could be configured in some manner? Or I can use it simple adding the jar files to my project?

However, these are parts of my code because I don’t know where is the problem:

LogicBean.java (the object that I should retrive):

@ManagedBean (name="logicBean" )
@WindowScoped
public class LogicBean implements Serializable 
{
    String pageIncluded;
    // getter and setter methods

    public String action(String value)
    {
        setPageIncluded(value);

        return "include";
    }
}

include.xhtml:

<ui:include src="#{logicBean.pageIncluded}"/> 

ProgettiController.java

@ManagedBean(name = "progettiController")
@SessionScoped
public class ProgettiController implements Serializable {

    private FacesContext context = FacesContext.getCurrentInstance();
    private LogicBean logicBean = context.getApplication().evaluateExpressionGet(context, "#{logicBean}", LogicBean.class);
    //getter and setter methods

    public void testMethod()
    {
        logicBean.action("WEB-INF/jsf/page1.xhtml");
    }
}

I tried also using @ManagedProperty(“#{logicBean}”) and setting the scope as WindowScoped but nothing change…


EDIT: after some new trials I found a strange problem, on my include.xhtml I added #{progettiController.logicBean.getPageIncluded()} and #{logicBean.getPageIncluded()} for check these two fields o?

Well, when I load the application for the first time the variables are correctly set and I see what I want, the second time the first variable is setted with the new value but the second is empty and I don’t see anything, but now is coming the strange thing… if I should try again the app I should open index.xhtml where I had some forms like this:

<h:form>
    <h:commandLink action="#{logicBean.action('/WEB-INF/jsf/progetti/List.xhtml')}" value="Show All Progetti Items"/>
</h:form>

and which is the result?
The first variable remains set with the old value (wrong) but the second is setted correctly so I can review the page like I would!
If someone can help me I will thank him/her forever!

  • 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-28T07:18:24+00:00Added an answer on May 28, 2026 at 7:18 am

    CODI is an extension to CDI, so you should manage your beans by CDI @Named annotation instead of the JSF @ManagedBean annotation. Then you can inject the other bean by CDI @Inject annotation. The following example should work:

    import javax.inject.Named;
    import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowScoped;
    
    @Named
    @WindowScoped
    public class LogicBean implements Serializable {
        // ...
    }
    

    and

    import javax.enterprise.context.SessionScoped;
    import javax.inject.Inject;
    import javax.inject.Named;
    
    @Named
    @SessionScoped
    public class ProgettiController implements Serializable {
    
        @Inject
        private LogicBean logicBean;
    
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Two days ago I was asked this question in an interview for Data Analyst
This has been bugging me for more than two days now, so i thought
This is a link to a question I had asked two days back, How
This post is closely related to another one I posted some days ago .
It was corrected two days ago. And yesterday I committed some changes to heroku
I'm revising my question from a few days ago. Rewrote my query. Can someone
I have been studying unicode and its Python implementation now for two days, and
How can I calculate the number of work days between two dates in SQL
I started learning the scala actors framework about two days ago. To make the
Two days ago I started working on a code parser and I'm stuck. How

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.