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>

1 Answer 1

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.

2
  • I modified the project facet for jsf to 2.1 as shown in this question but it still warns me stackoverflow.com/questions/8171862/… Jul 24, 2013 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, 2013 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.