0

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>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Narayana Nagireddi
  • 729
  • 1
  • 13
  • 33

1 Answers1

1

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I modified the project facet for jsf to 2.1 as shown in this question but it still warns me http://stackoverflow.com/questions/8171862/problems-configuring-jsf-2-0-on-eclipse-indigo – Narayana Nagireddi Jul 24 '13 at 16:28
  • Likely your Eclipse setup is messed up. You've 2 options: 1) Ignore it. It works perfectly fine. 2) Redo the eclipse config/setup. Don't do things of which you aren't 100% sure what you're doing. In any way, this is not a JSF problem (that part works fine). This is an Eclipse problem. – BalusC Jul 24 '13 at 16:34