Questions tagged [managed-property]

Managed property is mechanism of injecting managed bean into the property of another managed bean, by using @ManagedProperty annotation

66 questions
101
votes
2 answers

ViewParam vs @ManagedProperty(value = "#{param.id}")

What is the difference between defining View Params like this: And defining the property in the ManagedBean like this: @Inject @ManagedProperty(value =…
ehsun7b
  • 4,796
  • 14
  • 59
  • 98
22
votes
1 answer

@javax.faces.bean.ManagedProperty in CDI @Named bean returns null

I'm trying to deal with @javax.faces.bean.ManagedProperty but without success ! I've been following this guide, and it not seems that hard. But my code simply won't work! Here's a little snippet @ManagedBean @SessionScoped public class LoginBean { …
StepTNT
  • 3,867
  • 7
  • 41
  • 82
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 =…
9
votes
1 answer

CDI Replacement for @ManagedProperty

I'm trying to convert some code from Richfaces 4 showcase to use CDI instead of JSF annotations. I understand that I can use @Named to replace @MangedBean and @Inject to replace @ManagedProperty. But I'm having some trouble. I'm trying to convert…
Jflywheel
  • 135
  • 3
  • 8
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
8
votes
1 answer

@ManagedProperty in a Spring managed bean is null

I've some trouble with injecting one managedbean in another by defining a managedproperty. I'm googling and stackoverflowing now for 3 days, but with no result... I'm developing with eclipse 4.2 and deploying to an integrated Tomcat 7 So, can…
Alexander Bering
  • 603
  • 1
  • 6
  • 11
8
votes
3 answers

@Inject to pass params to a CDI @Named bean via URL

If I cannot use the @ManagedProperty annotation with @Named, because @ManagedProperty doesn't work in CDI(?), then how do you pass params in the URL to the facelets client? In my code, I want to pass javax.mail.getMessageNumber() to details.xhtml…
Thufir
  • 8,216
  • 28
  • 125
  • 273
7
votes
1 answer

@ManagedProperty with request parameter not set in a @Named bean

I've a CDI managed bean wherein I'd like to set request parameters as managed properties: import javax.inject.Named; import javax.enterprise.context.RequestScoped; @Named @RequestScoped public class ActivationBean implements Serializable { …
Milkmaid
  • 1,659
  • 4
  • 26
  • 39
5
votes
1 answer

Can @ManagedPropery and @PostConstruct be placed in a base class?

I'm using a hierarchy of classes and what I would optimally try to do is have @ManagedBean's that inherit a class that have @ManagedProperty members and @PostConstruct methods. Specifically, will this work? : public class A { @ManagedProperty …
Ben
  • 10,020
  • 21
  • 94
  • 157
4
votes
1 answer

@ManagedProperty does not work in a CDI managed bean

I try to learn JSF and encountered on a problem connected with ManagedProperty. However I have tried to use it, it always failed - null exception pointer. What am I doing wrongly? I have read some "similar posts" on stackoverflow, but they did not…
tpsa
  • 341
  • 1
  • 4
  • 13
3
votes
5 answers

@ManagedProperty does not reflect changes and keeps returning null

I'm trying to inject the value of one sessionscoped bean into a viewscoped bean but it keeps returning null, here's a snippet: import javax.faces.application.FacesMessage; import javax.faces.bean.SessionScoped; import…
Alaph432
  • 143
  • 2
  • 4
  • 10
2
votes
0 answers

Spring Web Flow & Java Server Faces @ManagedProperty injection always null during flow

I have succesfully integrated JSF with Spring WebFlow & PrimeFaces, but injection by @ManagedProperty is always NULL during my web flow but using @Autowired annotation injection works. I would like to know why @ManagedProperty does not work but…
2
votes
1 answer

JSF @managedproperty and @PostConstruct

I have a problem with JSF2 @ManagedProperty annotation. I have a managed bean that create a user, then i want to pass this user to another bean to display other informations relative to that user. So my code is below…
2
votes
1 answer

Inconsistency with @ManagedProperty

i have a bean with a list of global data in @ApplicationScoped like this: @ApplicationScoped @ManagedBean public class GlobalData { private List data = new ArrayList(); //getter and setterss goes here.. public void addSomeData(Object item)…
RRoman
  • 741
  • 9
  • 19
2
votes
1 answer

JSF ManagedProperty not working for class

Sorry for my English. I want to set @ManagedProperty for class TaskBO, but it is not works. TaskMB class: @ManagedBean(name="taskMB") @RequestScoped public class TaskMB implements Serializable { @ManagedProperty(value="#{TaskBO}") public…
z3r9
  • 167
  • 1
  • 4
  • 15
1
2 3 4 5