Pregunta

I am using below version of JSF and the namespace as shown in faces-config.xml But when I try to use view scope it shows a warning saying only request,session, application and none.

Implementation-Version: 2.1.6-SNAPSHOT
Bundle-Name: Mojarra JSF Implementation 2.1.6 (20111206-SNAPSHOT)
Bundle-Version: 2.1.6.SNAPSHOT

faces-config.xml:

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
          version="2.1">
<managed-bean>
    <description>Backing bean</description>
    <managed-bean-name>myBean</managed-bean-name>
    <managed-bean-class>com.myapp.bean.backing.MyBean</managed-bean-class>
    <managed-bean-scope>view</managed-bean-scope> 
</managed-bean>
¿Fue útil?

Solución

JSF doesn't do that. You're apparently being misled by the IDE (e.g. Eclipse) giving this warning as if it came from JSF itself. Note that it works fine when you ignore this warning and run the project as is.

You've apparently configured your IDE project to be a JSF 1.x project instead of a JSF 2.x one. You'd need to set it right in the project facets configuration in IDE project's properties.


Unrelated to the concrete problem, since JSF 2.0 there's no need to register beans in faces-config.xml anymore. You could just use @ManagedBean and friends for that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top