@ManagedProperty is not working in a managedbean

asked 08.04.2015 at 08:57

nwk2Team's gravatar image

nwk2Team
(suspended)
accept rate: 0%


I can not say why it is not supported, but I can give you a workaround, how you can access another ManagedBean in a ManagedBean or other Java Code:

ELContext elContext = FacesContext.getCurrentInstance().getELContext();
MyOtherManagedBean myOtherManagedBean = (MyOtherManagedBean) FacesContext.getCurrentInstance()
    .getApplication().getELResolver().getValue(elContext, null, "myOtherManagedBean");

The Bean which we access could look like this:

@ManagedBean(name = "myOtherManagedBean")
@RequestScoped
public class MyOtherManagedBean {
...
}
link

answered 08.04.2015 at 09:09

Christian%20Strebel's gravatar image

Christian St... ♦
3.2k31338
accept rate: 88%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×79
×51

Asked: 08.04.2015 at 08:57

Seen: 4,842 times

Last updated: 08.04.2015 at 09:40