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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:01:15+00:00 2026-06-04T01:01:15+00:00

I have the following ApplicationScoped bean package es.caib.gesma.gesman.data; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB;

  • 0

I have the following ApplicationScoped bean

package es.caib.gesma.gesman.data;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import es.caib.gesma.gesman.ejb.Dao;

@ManagedBean(name="priorityList")
@ApplicationScoped
public class PriorityList {

  @EJB
  Dao daoEjb;

  private List<Priority> priorities = null;

    public PriorityList() {
    }

    @PostConstruct
    public void refresh() {
      this.priorities = daoEjb.findPriorities();
    }

    public List<Priority> getPriorities() {
      return this.priorities;
    }

    public Priority fromId(int id) {
      for(Priority priority : this.priorities) {
        if (priority.getId() == id) {
          return priority;
        }
      }
      return null;
    }
  }

I try to inject that bean inside a Converter

package es.caib.gesma.gesman.data.converter;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;

import es.caib.gesma.gesman.data.Priority;
import es.caib.gesma.gesman.data.PriorityList;

@ManagedBean
@ApplicationScoped
public class PriorityConverter implements Converter {

  @ManagedProperty("#{priorityList}")
  private PriorityList priorityList;

  @Override
  public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
    ...
  }

  @Override
  public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
    ...
  }

  public void setPriorityList(PriorityList priorityList) {
    System.out.println("SET PRIORITYLIST " + priorityList);
    this.priorityList = priorityList;
  }

}

Whenever I try to access the property, it is null. The setter is never called.

From this question and this one, it looks like it is not possible to inject the bean the usual way (please correct me if I am wrong). There is any alternative so I avoid having to get the entire list of values from the EJB (= database access) each time?

  • 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-06-04T01:01:16+00:00Added an answer on June 4, 2026 at 1:01 am

    I think you should be able to pull this bean out from the HttpSession (it works for me in PhaseListener with SessionScoped bean)

    FacesContext context = FacesContext.getCurrentInstance();
    HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
    SessionForm sessionBean = (SessionForm) session.getAttribute("priorityList");
    

    Or if I may borrow article from BalusC about JSF communication, on the bottom is described how to make a converter from ManagedBean (so you could easily inject your ApplicationScoped bean there)

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

Sidebar

Related Questions

I have following seed input data: Payperiod start: Dec 3rd Payperiod end: Dec 16
I have following setup. from django.db import models from django.contrib.auth.models import User class Event(models.Model):
I have following type of data and I want to produce bar graph. Mark
I have following data in text file 375020222511963 284970411563422 290245594366931 I need to retrieve
I have following json data which I want to pass it to server using
I have following problem: I want to count data in one table, count data
In my application, I have an @ApplicationScoped CDI bean to store some information from
I have following array: $data['uploads']['ccc'] = 'something'; $data['uploads']['bbb'] = 'something'; $data['uploads']['aaa'] = 'something'; $data['downloads']['ccc']
I have following goal: From a list in main activity that extends ListActivity, I
Have following Java code,that creates StringBuilder with \n,i.e. carriage return delimiters: while (scanner.hasNextLine()){ sb.append(scanner.nextLine()).append(\n);

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.