How to programmatically access requestScope objects

Hi all,
in the backing bean of a page I set some request attributes using the following code:
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
request.setAttribute(<key string>,<MyCustomObject>);
and then I navigate to another page. In this page I fill in some input text fields using EL expressions, like #{requestScope.<key string>.<property from MyCustomObject>}.
However when inside the backing bean of this page, i try to programmatically access the requestScope using:
FacesContext context = FacesContext.getCurrentInstance();
<MyCustomObjectClass> var = <MyCustomObjectClass>context.getExternalContext().getRequestMap().get(<key string>);
I get the code return null.
What can I have done wrong that my code does not return the objects I pass through the requestScope while the EL expressions work?

Hi,
Do NOT use ExternalContext.getRequest(), but ExternalContext.getRequestMap().put() in the backing bean. As for the programmatic access, as mentionned it might be a scope issue. When is your managed bean code executed exactly?
~ Simon

Similar Messages

  • 11g How to programmatically access Calendar Rules

    Hi guys,
    I use BPM 11g and I'm trying to programmatically access calendar rules configuration for the organization in order to display labor dates in ADF task flow using Simple Expression like: now + 2 business days.
    Has anyone done this on 11g?
    Thanks in advance!

    Hi,
    Do NOT use ExternalContext.getRequest(), but ExternalContext.getRequestMap().put() in the backing bean. As for the programmatic access, as mentionned it might be a scope issue. When is your managed bean code executed exactly?
    ~ Simon

  • How to programmatically access XControl Methods

    I have developed a XControl that includes several internal methods. I would like to programmatically invoke these methods from outside the XCtl but I can't find a way to programmatically obtain an appropriate XCtl reference (i.e. one that allows access to these methods). Among other things, I have tried using the OpenG VI "Open VI Object Reference" which gives the correct reference but no access to the internal methods (probably cos it doesn't recognize XCtls as an allowable vi object class).
    Any help or suggestions would be greatly appreciated.
    Andrew

    Hi DrewBob,
    I can't reproduce the issue you're seeing. I can indeed access properties and methods for an Xcontrol from its reference inside a subVI.
    In any case, you can definitely get around this by following these steps. This is overkill, and these steps weren't necessary for me, but should ensure that you can do what you want:
    1. Create a reference to your Xcontrol. Right click the reference and select Create >> Control. Right click the new control and select Advanced >> Customize.
    2. In the Control Editor window, select Type-Def from the control type drop down menu. Save this type-def control reference.
    3. For the reference input in your subVI, use a generic control reference. You can find one of these in the controls palette under Modern Controls >> Refnum >> Control Refnum.
    4. Now wire that reference in your subVI into a To More Specific Class subVI. Place a copy of your control reference type def on the block diagram of the subVI and wire its output into the Target Class input. The resulting reference should resemble the picture below and will contain all necessary custom properties and methods. Furthermore, you could use a case structure and use this one VI to alter multiple different kinds of Xcontrols using one control reference input.
    If this doesn't work for you, could you post a small VI (or zipped project) that demonstrates the problems you are having?
    Message Edited by Jarrod S. on 03-27-200611:50 AM
    Jarrod S.
    National Instruments
    Attachments:
    ToMoreSpecificClass.JPG ‏12 KB

  • How can i access predefined objects(ex-participant  obj)inside  screenflow?

    Hi,
    Is there any way to get the pre-defined objects (ex- particpant, process, activity etc) inside the screenflow?
    I am passing those values as agruments to the screenflow and assigning to the screenflow instance. But I was wondering if they are directly accesible and I dont have to pass them as arguments to the screenflow.
    Thanks
    Pal

    You can use the built-in components. In ALBPM, when you use a component
    without explicitly creating an instance of it, the compiler creates a
    "default instance".
    The value of such instance is largely dependent on the component itself,
    for example, if you have a catalogued Java component with a default
    constructor, that is used as the default instance.
    Most built-in components have that behavior, in the case of the Process,
    Activity, and Participant components, the default instance fetchs the
    information from the context where they are being executed. So, if you
    call methods or attributes over the default instance of those components,
    you can get the information you want.
    As an example, run this code from an automatic activity in a ScreenFlow:
    logMessage "Participant: " + Participant.id using severity = FATAL
    logMessage "Activity: " + Activity.name using severity = FATAL
    logMessage "Process: " + Fuego.Process.id using severity = FATAL
    That should log the current processId, activity name and participantId.
    Note that this is context sensitive, so if you call the screenflow from a
    different activity, process or using a different participant, the correct
    values will be logged.
    Hope this helps,
    Juan
    On Mon, 10 Jul 2006 15:33:09 -0300, Puspendu Pal wrote:
    Hi,
    Is there any way to get the pre-defined objects (ex- particpant,
    process, activity etc) inside the screenflow?
    I am passing those values as agruments to the screenflow and assigning
    to the screenflow instance. But I was wondering if they are directly
    accesible and I dont have to pass them as arguments to the screenflow.>
    Thanks
    Pal

  • ListCellFactory - how to access an object's data associated with list cell?

    I am new to javafx and building a sample app to learn the basics. The app has a list view control and used listcellfactory to create listcells. Each list cell is composed of few labels and image. I populated list view with listViewItems function, where in it sends object[]; I have my own object with data that needs to be populated in the list cell. I have hard coded the object[] and that size is reflected in list view items size. However, I am not able to populate the object data in individual labels.
    In the following code, I can only get the string representation of the object and I am unable to figure out how to individually access the object's data. Please help me with this.
    function listCellFactory(): javafx.scene.control.ListCell {
    var listCell: javafx.scene.control.ListCell;
    def offerLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def descriptionLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def friendLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def offerImgView: javafx.scene.image.ImageView = javafx.scene.image.ImageView {
    image: imagetrial
    fitWidth: 300.0
    fitHeight: 250.0
    def offerVerticalBox: javafx.scene.layout.VBox = javafx.scene.layout.VBox {
    content: [ offerLbl, descriptionLbl, friendLbl, offerImgView, ]
    spacing: 6.0
    listCell = javafx.scene.control.ListCell {
    node: offerVerticalBox
    return listCell
    }

    If I understand you question, it should be (listCell.data as YourClassName)
    Edited by: AigarsP on Oct 21, 2010 2:10 PM

  • How to create new java objects in native methods?

    Hello,
    Is it possible to create java objects and return the same to the java code from a native method?
    Also is it possible to pass java objects other than String objects (for example, Vector objects) as parameters to native methods and is it possible to return such objects back to the java code?
    If so how can I access those objects (say for example, accessing Vector elements) inside the native code?
    What should I do in order to achieve them?
    Regards,
    Satish

    bschauwe is correct in that constructing Java objects and calling methods on Java objects from native code is tough and takes some study. While you're at it, you might want to check out Jace, http://jace.reyelts.com/jace. It's a free open-source toolkit that really takes the nastiness out of doing this sort of stuff. For example,/**
    * A C++ function that takes a java.util.Vector and plays around with it.
    public void useVector( java::util::Vector& vector ) {
      // Print out all the contents of the vector
      for ( Iterator it = vector.iterator(); it.hasNext(); ) {
        cout << it.next();
      // Add some new elements to the vector
      vector.addElement( "Hello" );
      vector.addElement( "world" );
    } All this code just results in calls to standard JNI functions like FindClass, NewObject, GetMethodID, NewStringUTF, CallObjectMethod, etc...
    God bless,
    -Toby Reyelts

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • Access abap object  from external system

    In R/3 have a Business Objects how can I access this object, for example Workflow BO, from java (external system) using XI????
    My goal is create workflow´s in r/3 sending as input the workflow characteristics and then create the workflow in R/3 and sending as output the idworkflow was creatde.
    thanks in advanced.

    Dear Murali,
    Try this
    a)Start transaction SXI_CACHE.
    b)From the context menu XI Runtime Cache select Start Complete Cache Refresh.
    If you still face issue try this .
    Many actions require to access System Landscape Directory content from the Integration Builder. To optimize performance, this content is loaded into a cache so that the System Landscape Directory does not have to be accessed directly each time that System Landscape Directory content is required.
    However, this cache is not automatically updated if changes are made to the content of the System Landscape Directory. For this reason that we delete the System Landscape Directory cache if changes have been made to content in the System Landscape Directory. The cache is then filled each time that the System Landscape Directory is accessed. If we log on to the Integration Builder after we have made a change in the SLD, we do not need to delete the SLD cache.
    To clear the SLD cache, from the Integration Builder main menu, choose Environment ® Delete Cache for SLD Data.
    Once we have deleted the cache for SLD data, accessing objects in the SLD may take longer than usual initially.
    Regards
    Agasthuri Doss

  • Access to object in xmlns

    Hi,
    I've come across such a silly probem shown in example below:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:views="*" creationComplete="initApp()">
        <mx:Script>
            <![CDATA[
         import mx.controls.Text;
         public function initApp()
          label1.text = "View1 changed";
         ]]>
        </mx:Script>
        <views:view1 label="view1" width="100%" />
    </mx:Application>
    view1.xml file contains:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%">
    <mx:Label id="label1" x="10" y="50" text="View1"/>
    </mx:Canvas>
    It renders error:
    1120: Access of undefined property label1.
    How can I access label1 object from main file?

    Next I wanted to call function declared in main app:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:views="*">
        <mx:Script>
            <![CDATA[
            import mx.controls.Button;
         public function test():void
         ]]>
        </mx:Script>
        <views:view1 id="myComp" />
    </mx:Application>
    view1.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%">
    <mx:Button id="button1" label="Button1" click="test()"/>
    </mx:Canvas>
    1180: Call to a possibly undefined method test.    ViewStackTest/src    view1.mxml    line 3    1251498782218    1661
    How can reference to test()?

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • How to access an object in a bean

    I am looking for a way to access an object in a bean and make available to the page.
    for example if i have a Bean called User and it contains an attribute Called Company as an attribute in User. Now I have User.getCompany(). and I can do this
    <%User user = request.getUser();
    Company company = user.getCompany();
    request.setAttribute("comp", company); %>
    how do I do this with useBean ?

    I am looking for a way to access an object in a bean
    and make available to the page.
    for example if i have a Bean called User and it
    contains an attribute Called Company as an attribute
    in User. Now I have User.getCompany(). and I can do
    this
    <%User user = request.getUser();
    Company company = user.getCompany();
    request.setAttribute("comp", company); %>
    how do I do this with useBean ?You can access a JavaBean Object property of another JavaBean inside the JSP with the use of EL (Expression Language)
    So if you are using JSP 2.0 or higher try this:
    <jsp:useBean id="user" class="your.package.User" scope="request"/>
    ${user.company.id}I tested the above and it works.
    Note that you need to set the Company object in the User object before trying to access it inside the JSP.
    You can also set it in the JSP if you want, (before trying to access it), but its cleaner to do it in a Servlet.
    Both User and Company must follow JavaBeans notation.
    So in the above case the User object is something like this:
    package your.package;
    public class User{
       private Customer customer;
       public User(){}
       public Customer getCustomer(){
          return customer;
       public void setCustomer(Customer customer){
         this.customer = customer;
    }And your Customer JavaBean is something like this:
    package your.package;
    public class Customer{
       private int id;
       public Customer(){}
       public int getId(){
         return this.id;
       public void setId(int id){
         this.id = id;
    }

  • How to access an object's variable from native code

    i am passing an object in a native method.i have to change the value of the object's variable.how do i access the variable of object and assign it new value from c++ code.when i try to access it i get a message that the variable must have a class/sruct/union type.
    pl. help.

    I'll tell You if You send me the structure of this object in Java. And a name of field what are You thinking about.
    Maciek

  • How to access Business Objects Explorer?

    I am new to Business Objects and would like to know how to access Business Objects Explorer from my local system. I have Business Objects XI 3.1 installed on my system.
    I would like to know if BO explorer requires a separate installation package? If yes, how can I acquire it?
    If No, what are the steps to integrate the BO Server with the BO explorer?
    Edited by: Bhavani I on Jan 28, 2010 11:23 AM

    Hi,
      You can refer to the below link for more details on BO EXplorer,
    https://cw.sdn.sap.com/cw/servlet/JiveServlet/previewBody/119973-102-1-220562/BO%20Explorer%20Implementation%20checklist.pdf
    Regards,
    Balajee
    Edited by: Balajee Sivakumar on Apr 27, 2011 6:30 PM

  • How to access COM+ Objects From JSP

    Friends,
    We have a requirement to access COM+ objects from JSP. Please guide me on this.
    Thanks in advance.
    Tarani

    Sanyam wrote:
    if there is any .dll extension file, how can we read that file in labview?
    You can use Call Library Function node to call that dll file and use it in LabVIEW. Read the help and you will get more details.

  • How to access Business object type attribute from a method/function modul ?

    Hello,
    i have created a business object type object along with attributes and methods. Now inside the method i want to access the attributes. inside the method i am writing:
    data a type XXX.
    a = me->attribute
    this is creating a compilation error.
    Now the method is defined as a function module in some package, so can anyone inform me how to access object attributes from the function module ?
    pointes are awarded
    Regards

    Hello,
    thanks for your answer, but this too did not work, "=>" is for static attributes and the attributes i have are not static. Moreover, i tried it but it gave the same error :
    the abap error was when i was checking the code is :
    the type me=>documenttype is unknown
    as you know in SWO1 i created an object and when i create a method you link it to a function module and this is where you have the implementation of the method, so from this method how can i access the attributes on the main object that i created in SWO1
    regards

Maybe you are looking for