This discussion is archived
7 Replies Latest reply: Jul 3, 2009 1:22 AM by 680588 RSS

ADF: Request Scope

560324 Newbie
Currently Being Moderated
I am developing a Standalone ADF Application. I need to maintain certain values throughout the application run time, till the application is terminated.

Is there any way to attach the values to the requestScope? Is there any limitation of values to be attached to the request scope?

Regards

Anjali
  • 1. Re: ADF: Request Scope
    John Stegeman Oracle ACE
    Currently Being Moderated
    Anjali,

    I assume you are talking about an ADF Faces application (based upon JSF)? If so, request scope will not be able to maintain values throughout the application run time. You want to use session scope (if it's for a user's session) or application scope (if it's global to the app). You can simply create JSF managed beans with the proper scope and store your data that way.

    If you are not talking about JSF (not clear what a "standalone adf application is") - please explain more about what you mean by requestScope.

    John
  • 2. Re: ADF: Request Scope
    560324 Newbie
    Currently Being Moderated
    Thanks John.

    As you have mentioned, my Application is ADF Faces application (based upon JSF).

    If I need to set values to the Application Scope or Session Scope, how can i archive that?

    Also, I need to set a Text Input or Output box value based on the Command Button or link, Should I have to write any Java Code for the same, or Can I set and bind variable like #{request.outMsg} i.e. Through EL?

    Regards

    Anjali
  • 3. Re: ADF: Request Scope
    BranislavNemec Expert
    Currently Being Moderated
    Hi Anjali,

    about how to create session backing bean:

    -create java class with the content:
    package mypackage;
    public class MyBB {
        
        private String value = "Frank";
    
        public MyBB() {
        }
    
    
        public void setValue(String value) {
            this.value = value;
        }
    
        public String getValue() {
            return value;
        }
    }
    then in adfc-config.xml :
    <?xml version="1.0" encoding="UTF-8" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <managed-bean>
        <managed-bean-name>myBB</managed-bean-name>
        <managed-bean-class>mypackage.MyBB</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </adfc-config>
    then create .jspx page:
    <?xml version='1.0' encoding='windows-1250'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=windows-1250"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
            <af:inputText label="Label 1" id="it1" value="#{myBB.value}"/>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    I hope you got the idea

    regards,

    Branislav
  • 4. Re: ADF: Request Scope
    560324 Newbie
    Currently Being Moderated
    Thanks for you update. I have got some idea about the bean.

    But Can you anyone tell me whether is that anything called request Scope?

    I was confused on seeing the tutorial document Tutorial for Forms/4GL Developers.

    Regards

    Anjali
  • 5. Re: ADF: Request Scope
    680588 Newbie
    Currently Being Moderated
    Hi Anjali,

    These are the different scopes

    * Application scope lasts until the server stops the application. Values that you store in an application bean are available to every session and every request that uses the same application map.
    * Session scope begins when a user first accesses a page in the web application and ends when the user's session times out due to inactivity, or when the web application invalidates the session, such as, for example, by calling session.invalidate().
    * Request scope begins when the user submits the page and ends when the response is fully rendered, whatever page that is.


    Rgds,
    Ravi
  • 6. Re: ADF: Request Scope
    560324 Newbie
    Currently Being Moderated
    Thanks Ravi,

    Can you tell me utmost whats can i do with request scope? store temp values with in the page scope?

    Regards

    Anjali
  • 7. Re: ADF: Request Scope
    680588 Newbie
    Currently Being Moderated
    Anjali,

    if u want to have values passed between pages u can use it ....u can even use a page flow scope ....

    some thing like this <tr:setActionListener from="#{row}" to="#{requestScope.UserSearchBackingBean.showNoRecords}"/> and u can get the value in the next page using the request scope.

    Rgds,
    Ravi

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points