Questions tagged [managed-bean]

"Managed bean" is a Java EE specific term for Javabean classes which are designed to act as a controller in some MVC application. They are often referred in context of JSF and CDI.

"Managed bean" is a Java EE specific term for Javabean classes which are designed to act as a controller in some MVC application. They are often referred in context of JSF and CDI.

1004 questions
12
votes
1 answer

How to configure a start up managed bean?

I want a managed bean to run internally on start up in my JSF web application when the application loads. How can I write this class and configure in Glassfish?
user1504940
  • 175
  • 4
  • 14
12
votes
1 answer

JSF bean: call @PostConstruct function after ViewParam is set

I have a product.xhtml and a ProductBean. I use /product/{id} to access the products so I have a viewParam in product.xhtml with value=ProductBean.id. The problem is that inside the bean I use an init function with a PostConstruct annotation in…
user579674
  • 2,159
  • 6
  • 30
  • 40
12
votes
1 answer

Accessing injected dependency in managed bean constructor causes NullPointerException

I'm trying to inject a DAO as a managed property. public class UserInfoBean { private User user; @ManagedProperty("#{userDAO}") private UserDAO dao; public UserInfoBean() { this.user =…
11
votes
3 answers

How to reference JSF managed beans which are provided in a JAR file?

I have a WAR file with the following structure: The JSF managed bean BusinessObjectTypeListController is located in commons-web-1.0.jar in /WEB-INF/lib and referenced in BusinessObjectTypeListView.xhtml. When I run my web application and I call…
Francesco
  • 2,350
  • 11
  • 36
  • 59
11
votes
5 answers

How to register a JSF managed bean programmatically?

I'd like to register/add a Managed Bean class programmatically (from within a Servlet init()) into application scope. How can I do that with JSF 1.2?
Zeemee
  • 10,486
  • 14
  • 51
  • 81
11
votes
2 answers

JSF 1.2: How to keep request scoped managed bean alive across postbacks on same view?

Is it possible to keep a request scoped bean alive across postbacks on the same page? The general problem is, as the bean gets trashed on end of request and recreated on every form submit, for example the booleans behind dynamically manipulated…
Chris
  • 111
  • 1
  • 4
11
votes
7 answers

Transaction is required to perform this operation (either use a transaction or extended persistence context)

I'm using Wildfly 10.0.0 Final, Java EE7, Maven and JPA 2.1. When I am querying my database for records it works fine and lists out the employees, but when I am trying to persist a new employee it gives me the following…
masm64
  • 1,222
  • 3
  • 14
  • 31
10
votes
4 answers

Is there a way to call a method upon leaving a page with JSF or PrimeFaces?

Is there a way to call a method upon leaving a page with JSF?
Landister
  • 2,194
  • 7
  • 38
  • 56
10
votes
1 answer

ManagedProperty not injected in @FacesConverter

I'm trying to inject a ManagedBean in my FacesConverted the following way: @ManagedBean @RequestScoped @FacesConverter(forClass = Group.class) public class GroupConverter implements Converter { @ManagedProperty("#{groupService}") private…
Mateusz Dymczyk
  • 14,969
  • 10
  • 59
  • 94
10
votes
2 answers

UnserializableDependencyException: WELD-001413: The bean declares a passivating scope but has a non-passivation-capable dependency

I have the below CDI managed bean: @Named @SessionScoped public class InfoPageController implements Serializable { @Inject private InfoPageMapper mapper; } It throws the below exception during deployment to GlassFish 4.1: Exception while…
RVogt
  • 103
  • 1
  • 1
  • 6
10
votes
1 answer

Is @javax.annotation.ManagedBean a CDI bean defining annotation?

The Question Given that the archive we deploy is an "implicit bean archive" (see below), using @javax.inject.Inject to inject a @javax.annotation.ManagedBean into another managed bean work in WildFly 8.1.0, but it won't work in GlassFish 4.0.1-b08…
Martin Andersson
  • 18,072
  • 9
  • 87
  • 115
10
votes
1 answer

What is difference between JavaBean and ManagedBean

I am reading What components are MVC in JSF MVC framework? In the big architectural picture, your own JSF code is the V: M - Business domain/Service layer (e.g. EJB/JPA/DAO) V - Your JSF code C - FacesServlet In the developer picture, the…
Jeff Lee
  • 783
  • 9
  • 17
9
votes
2 answers

@EJB in @ViewScoped @ManagedBean causes java.io.NotSerializableException

I've read @EJB in @ViewScoped managed bean causes java.io.NotSerializableException, but my state saving setting is server. Here is what I have: web.xml:
Michele Mariotti
  • 7,372
  • 5
  • 41
  • 73
9
votes
2 answers

JSF Managed bean and managed property both necessary?

I'm new to JSF and was wondering: If I have a controller that handles all the work for a given page and a bean that holds all the data for said page, is It necessary to have both the @ManagedProperty(value="#{myBean}") annotation on the…
Mark W
  • 5,824
  • 15
  • 59
  • 97
9
votes
2 answers

always give me null contents

I'm trying to get working like what is documented in the primefaces user guide, and some posts founded there. Upload file in JSF primefaces. the environnement is : javaee full + jpa + jsf 2.2 + primefaces 4 + glassfish v4 I m posting again, because…
mohamed abdelbassat
  • 271
  • 1
  • 3
  • 10