Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF requestScope/sessionScope/applicationScope implicit objects

User_HWHT9Mar 12 2007 — edited Oct 25 2007

The JSF 1.1 spec under section 5.3.1.3 says that a managed bean created within a particular scope, be it a request, session or application scope, should be available through the corresponding EL implicit object requestScope, sessionScope or applicationScope respectively.

As an example I've created the following simple bean:

public class MyBean {
  public MyBean() { }

  String myValue = "a value";

  public void setMyValue(String myValue) { this.myValue = myValue; }
  public String getMyValue() { return myValue; }
}

....and configured it my faces-config.xml file as:

<managed-bean>
  <managed-bean-name>myBean</managed-bean-name>
  <managed-bean-class>MyBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

....finally referencing it within my ADF Faces page using:

<af:inputText value="#{requestScope.myBean.myValue}"/>

But it throws:

javax.faces.el.PropertyNotFoundException: Error testing property 'myValue' in bean of type null
at com.sun.faces.el.PropertyResolverImpl.isReadOnly(PropertyResolverImpl.java:274)
...and so on

I know that I can actually access the bean as #{myBean.myValue}, but my understanding from the JSF spec is that the requestScope approach should work.

What am I doing wrong here? Is it that only attributes, be they Strings or whatever, rather than fully blown objects (be it a backing bean), are accessible via the request/session/applicationScope implicit objects?

Regards,

CM.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2007
Added on Mar 12 2007
8 comments
8,071 views