0

I upgraded an old JSF web application from MyFaces 1.1 to MyFaces 2.2.12, mainly using Migrating from JSF 1.2 to JSF 2.0 as a guide.

Using Migrating JSF 1.1 with Ajax4jsf 1.x to JSF 2 as another guide, I also try to replace a4j:keepAlive occurences with adding @ViewScope annotations to the corresponding beans. Up until now, the beans in our application where managed via the faces-config.xml with entries like this:

<managed-bean>
    <managed-bean-name>SomeBean</managed-bean-name>
    <managed-bean-class>org.some.package.SomeBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

I am also trying to follow advices like this about replacing as much of the faces-config.xml as possible. But when I added the bean and scope annotations like this

@ManagedBean
@ViewScoped
public class SomeBean () {
    ...

to my bean classes and then ran into an unrelated error in the web application, the MyFaces error debug page showed me that SomeBean is still session scoped, not view scoped.

I haven't deleted the corresponding managed-bean entry from the faces-config file, yet, so I was wondering if settings made in that configuration file override any corresponding annotations in the Java files. Is that the case?

Community
  • 1
  • 1
scholt
  • 147
  • 2
  • 16
  • Lots of these things can be found in the spec, or even in the javadoc. This https://www.google.com/search?q=managed-bean+annotations+override+faces-config provided some insight for me – Kukeltje May 15 '17 at 09:06
  • And one of the links is even to a SO post... Please improve your searching... – Kukeltje May 15 '17 at 09:08

0 Answers0