Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 874 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spring JSF integration: how to inject a Spring component/service in JSF managed bean?

#1
I understand that a managed bean works like a controller, because your only task is "link" the View Layer with Model.

To use a bean as a managed bean I must declare `@ManagedBean `annotation, doing that I can communicate JSF with bean directly.

If I want to inject some component (from Spring) in this managedBean I have two possibles ways:

1. Choose the property in ManagedBean (like "BasicDAO dao") and declare `@ManagedProperty(#{"basicDAO"})` above the property. Doing it, i'm injecting the bean `"basicDAO"` from Spring in ManagedBean.

2. Declared @Controller in ManagedBean Class, then i'll have `@ManagedBean` and `@Controller` annotations, all together. And in property `"BasicDAO dao"` i must use `@Autowired` from Spring.

Is my understanding correct?
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through