Obtaining a reference to an object created in another page

Hello, In my webapp, i have a controller servlet which delegates the task to appropriate handler classes. My handler class performs the database access, then packages the result set object into a vector. I then create a new object of a javabean with a setPost() method which houses the output. My question is after this is done i forward control to the appropriate jsp for display. But how can i reference the object created in the page before. Will the request.setAttribute() method work for passing the reference to the object, to that jsp page? In other words i just want to access an object created in a different sevlet. Any help would be much appreciated
thanks
Gabriel

Hi
Yes, if you set the attribute, in this case the Java Bean in the request, it will be available in the JSP to where the request has been forwarded. Note however that the Object's lifetime is limited by that of the request. For Objects which need longer lifetimes you could place them either in the session or the ServletContext. The latter case will give the Object application wide scope and also a lifetime limited only by the lifetime of the application.
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support

Similar Messages

  • Acessing objects created by another java program

    ok ill give a higher level view of the problem.....
    i think this is a fundamental problem
    I have 3 java programms which take information and store it. all the type of information is the same so I created a class DataStructure....just to store information. this class i put in a package DataStruts and i call the class in the java programs by " import DataStruts.* ; "
    In the java prog. i create instances of DataStructure like
    eds = new DataStructure();
    in the first java prog i create an instance "eds", in 2nd "ads" and in third "pds".
    now in third prog i want to print all the information so i try to retrieve the data stored in the objects "eds" and "ads" by the previous 2 java programs.
    however the third prog does not recognise the variables eds and ads. i think this is because their instances have been created by the first 2 java programs.
    how do i make these instances of DataStructure available to the last program.??plese let me know.
    thankyou in advance.

    Can someone help me make the connection between the
    statements
    I thought a class's public methods were available
    to any other class that has access to the first
    class.
    and
    They are, but only to code running in the same
    VM.
    The first means that when you're writing a program, if class Foo has a bar() method that's declared public, then the compiler will allow you to call bar() on an in instance of a Foo. That's all it means.
    The second means that if I start two different VMs (two separate Java program's) the publicness that made it legal to call Foo's bar() doesn't automagically give the first program a way to know about or see or call a Foo's bar() in the second one.

  • Obtaining activex reference from activex container

    I have a VI with an embedded MediaPlayer activex object inside an activex container.  Additionally, I have a seperately run VI which I want to be able to control the MediaPlayer obejct in the first VI.  These VIs are opened seperately, so I cannot pass information directly from one to another (i.e., I can't directly pass the MediaPlayer activex reference to the second VI directly).  Therefore, the second VI obtains a reference to the activex container object by searching the first VI's controls and filtering by label.  I can typecast the control reference to the level of activex container, but from there I have no way of obtaining a reference to the object embedded in it.  Is there are way to do this?  The "To more specific class" function does not accept activex references for typecasting, and the automation open does not accept activex container references.  I've searched through the forums, and while there is plenty on activex references and containers, there doesn't seem to be anything that addresses my issue.

    I'm not 100% about whether this will work, but give it a try. Once you have a reference to the container, use the 'Value' property. This will give you a variant. From here you can use Variant to Data, connect a MediaPlayer constant reference to the type input and you should get the correct reference out.
    Also, you could simply get a reference to the VI with the ActiveX control and use the method 'Control Value: Get[Variant]' to get the value of the control instead of getting a list of all the controls and searching for the one you want.

  • How to add a reference to an Object?

    In a particular class, how can we create a reference to an object created in a different class?

    Have that "different" class provide that reference, possibly as the result of calling a method in that "different" class.

  • Cannot create weak reference to 'classobj' object

    I am trying to run the python Script in a C# program using Iron Python I am getting this type of Error
    cannot create weak reference to 'classobj' object
    I am using this code for running the python code
    var ironPythonRuntime = Python.CreateRuntime();
    try
    dynamic loadPython = ironPythonRuntime.UseFile("Program.py");
    catch (Exception ex)
    Console.WriteLine(ex.Message);

    Hi Mahesh,
    About IronPython issue, It's third-party product.  Please redirect to IronPython forum.  The link as below.
    https://ironpython.codeplex.com/workitem/list/basic
    After search this error,
    this thread tells me.
    Try to use virtualenv. It is used to separate many instances of python and it's libraries - you can have as many virtual environments as possible: python 2.5 , 2.6 , 2.7, whatever - with any combinations of libraries - so you can have for example five
    python 2.6 instances with different sets of libraries configured.
    By the way, here is also a blog talking about
    Running IronPython Scripts from a C# 4.0 Program
    Now I will move your thread to "off-topic" forum. Thanks for your understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can i reference a MIME object within a correspondence format through...

    how can i reference a MIME object within a correspondence format through TX oofo or se71?
    Hi, I need to put a MIME object within a correspondence's format that i've already done through Tx oofo. My problem is, that i don't know exactly how can i make the reference of that MIME object in the format? and What structure type do i have to use in order to make appear the MIME object in my correspondence's format? Does anybody can help me with this?   
    Regards    Hector

    Frank,
    I tried to find some examples/samples on how to create CollectionModel for a table component but not successful.
    Can you clarify the following ?
    1. "CollectionModel" is referenced only by af:table attributes "value", "selectedRowKeys" and "selectionListener".
    The rest of af:table attributes such as "rows", "fetchSize" used to reference the iterator binding in the binding container via the EL expression "#{bindings.VOIteratorBinding.xxx} .
    What should I replace that EL expression with?
    2. I heck out the bean method to create the CollectionModel as following, is it close to what you mean?
    public void initBusinessDataDashboardView() {
    OperationBinding operation = BeanUtils.getOperationBinding("getPanelBusinessData");
    Map params = operation.getParamsMap();
    Key panelKey = getPanelInfoView().getKey();
    params.put("panelKey", panelKey);
    params.put("maximizedView", false);
    panelView = (ViewObject)operation.execute();
    // Heck code to create CollectionModel
    RowSet rowSet = panelView.getRowSet();
    ArrayList rowList = new ArrayList();
    while (rowSet.hasNext()) {
    rowList.add(rowSet.next());
    model = new ChildPropertyTreeModel(rowList, null);
    // To be used to set up af:table value, selectRowKeys, selectionListener via EL expr #{backingBeanScope.MyBean.model.xxx}
    public CollectionModel getModel() {
    return model;
    Am I on the right track?
    Edited by: Pricilla on May 4, 2010 2:20 PM

  • Can I get the reference to all objects in JVM Heap?

    Hello,
    Thanx in advance for reading (and replying) to this problem.
    I need to find an object whose reference I dont have.
    I feel the best place to search for is the JVM heap.
    If I get that JVM heap, and am able to get all the objects created, I can locate the particular object that I am looking for.
    Is there a way to od this????
    Any suggestions ????
    Vikas

    JVMTI will mostly help you in this case. But i recomend you to review you application design, because such services are unsafe and rather tricky.

  • Getting references to the objects in a VM to dynamically link MBeans

    Hi, I am dynamically generating MBeans and using Apache BCEL to change the resource classes to link themselves to the MBeans. The objective is to instrument applications wich we can't access the code and, if possible, do it on a running one.
    I could use the Instrumentation API to change the classes of the application and the Attach API to do it on a running application, but only new instances would be affected, so the previously created objects would not be managed. I can generate MBeans in many ways, but can't link them to already running application objects.
    So, what i want to know is in the title: is there a way to get references to the objects actually loaded in a Virtual Machine or another way to link an MBean to a running object?
    I saw McManus talk at Sun One 2006 about the different ways to link MBeans to application objects, but all of them look to need code changes or previous suport to dependency injection, for example.
    http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-3523.html
    I need it to a technical writing, so an official word can be enough, or even more helpful than a solution.
    Thanks,
    Gustavo

    Gustavo,
    Assuming I understand your question correctly, the only way I can see that you can enumerate instances of objects in a Java VM without changing the classes of those objects in any way is to use JVMTI <http://java.sun.com/javase/6/docs/platform/jvmti/jvmti.html#Heap_1_0>. That requires you to write native code somewhere as part of your solution. It is applicable to already-running apps via attach-on-demand <http://java.sun.com/javase/6/docs/jdk/api/attach/spec/index.html>. The MLet service from the JMX API might be convenient here to bridge from the jar file that the Attach API expects to the native code that you need to access JVMTI.
    As you can see this is pretty advanced stuff, but your ideas are interesting and I'd be interested in knowing how they work out.
    Regards,
    �amonn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus

  • Reference to C# objects in TestStand - how to save and retreive them

    I am new to LabView and TestStand.
    I want to use 2 .NET objects in those applications
    In Labiew, I successfully created the objects, manipulate the functions through VIs and closed the references.
    While I could use the VIs for TestStand, I would rather use the DLL directly.
    I am able to create both objects in a sequence, but I have problems with the following:
      - I don't know how to save the reference to the object after the constructor is run.
        - is the object stored in Globlal variables? I tried 'RunState.Engine' but it does not work
      - I don't know how to get the reference back in the other steps where I want to reuse the object to invoke a method on.
      - Once I can do the above, I need to get it to work in the 'batch' or 'parallel' modes.
         I am using successfully the 'RunState.TestSockets.MyIndex' to select my testing resources,
         but I am still confuse as where the array of objects would be.
         Note that I already set the number of DUT <> 1 and I can create successfully my 2 objects in X instances.
    Thanks,
    Daniel Coupal

    dcoupal,
    Getting the reference to the object involves specifying that as a return value in one of your parameters when you specify the module for that action. Inside of the parameters table you can also save that return value as a local object reference and then use it later on in the sequence.
    Regarding your second question, I'm not sure what the array of objects is that you're referring to but this KB might be of some assistance.
    Message Edited by Jon M on 11-01-2006 12:44 PM
    Test Engineer - CTA

  • How is an object created in a workflow ?

    Hello,
    When i create a task and assign an organizational business object to it along with a method. When the workflow is activated then it will call this method, but who will create the object and who will fill up the initial attributes of the object. As an example:
    if my organizational business object is called CAR, and it has an attribute caller COLOR, and a methif called get_Color. Then when i start my workflow, it will call the method get_color, but will it first create the CAR object ?
    -Can someone point out how the workflow works ?
    -Onemore question, do you know a good resource on how to create Organizational business objects
    thanks
    points are rewarded.
    Hassan

    It is not clear my your message if you want to create a new instance of an object (i.e. a new car) or if you want to create an instance of an existing car.
    If you want to create a new car, you need to see if there is a method CREATE for this object and if a task already exists for this method.  If no tasks exists, then you need to create one.
    My guess is that you want to create an instance of an existing car (i.e. you want car number 1234 and exectue method get_color).  You will use object SYSTEM, method GENERICINSTANTIATE to accomplish this.  The easiest way to do this is by using workflow wizards.  Under the workflow wizards "others" folder, select wizard "Include 'Create Object reference'".  It will create a background task that will create an object instance.  All you need to do is bind the object key to the task and you are all set.
    Mike

  • Garbage collection of objects created inside a method

    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?
    here with code
               public List<StgAuditGeneral> getAudits(
              List<StgAuditGeneral>  audits= new ArrayList<StgAuditGeneral>();
                  for(Map<String, String> result :results ){
                   audits.add(new MapToObject<StgAuditGeneral>() {
                        @Override
                        public StgAuditGeneral getObject() {
                                             StgAuditGeneral  stg= new StgAuditGeneral();
                             return stg;
                   }.getObject());
              }in the above method I cam creating tons of objects wil they be garbage collected immediatedly after jvm leaves the method ?

    user11138293 wrote:
    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?If there are no reachable references, to those objects, then when the method ends, they become eligible for GC. If and when they are actually collected is something we can't know or control, and generally don't care about. The only guarantee is that everything that can be collected will be collected before an OutOfMemoryError is thrown. So from our perspective, once it's eligible for collection, it is effectively collected.
    If you pass references to those objects to something else that holds onto them after the method ends, then they are still reachable, and not eligible for collection.
    However, you almost never need to even think about whether something is eligible for GC or not. It works pretty intuitively.

  • Vector clone references the same objects??

    Hi all
    I'm developing a simple chess program.
    Obviously, each move the user tries must be checked against the following sets of chess rules:
    1.) Whether it is that colour player's turn to move
    2.) Whether this move is valid for this specific piece (eg. 3 forward for a King --> invalid of course)
    3.) Whether this move will jeopardize the player's king (put it in check)
    If from any of the above the move is found to be invalid, the move is not executed.
    My program structure is briefly this:
    A. abstract super class 'ChessPiece' - subclassed by the various specific Chess Piece classes.
    Each of the specific ChessPiece subclasses must implement an abstract method to check if a
    proposed move is valid, and also a method to actually do the move...
    B. 'PieceManager' class - has a Vector of ChessPieces:
    This class checks whether the given move is valid:
    For the piece: by calling the checking method (see A above)
    For the general game: by making sure the given move doesn't put the player's king in check.
    NOTE: In chess (for those who don't know), it is illegal to move any piece if, at the end of
    the move, your king will be in check [possible to be captured by any enemy piece]
    This last check I want to do in the following way:
    1) copy/clone the entire PieceManager object
    2) in this copied object, actually do the move
    3) still in the copied/cloned object, see if the moving player's king is now in check
    4) based on this evaluation, execute the move in the original PieceManger object or don't...
    The Problem:
    When I clone this PieceManager object, its 'pieces' Vector is obviously also cloned.
    BUT it seems that the cloned 'pieces' Vector references the same ChessPiece objects
    as those referenced by the original 'pieces' Vector; ie the 2 Vectors are sharing the same Objects.
    Thus, when I actually execute the move in the test/cloned PieceManager object,
    the original PieceManager's corresponding piece is moved too (well, it seems it is the same piece...).
    I am pretty stuck with this.
    I've tried the Vector clone method; it doesn't seem to copy the objects, but create another reference
    to the same objects, as I've said.
    I've tried cloning the entire object ; also not helping......
    I'd love any comments, helpful pointers, suggestions.
    Also any comments on my program structure... is a Vector the best tool for this job?
    Thanks very much -
    lutha

    Hi all, OP here.
    Ok thanks guys for all your posts...
    two points:
    1) I have tried the "copy constructor", and it seems to be doing the same thing. (ie 'shallow clone')
    What's really frustrating me is that nothing I do seems to actually physically copy the Vector's objects
    to new, separate copies of those objects...
    I had my PieceManager class implement Cloneable (just in case - not too sure on that one; in fact I
    commented that out later), and I overrode the clone method like this:
    public Object clone ()
            PieceManager pm = new PieceManager ();
            Vector pcs = new Vector ();
            // Enumeration e = pieces.elements ();
            //while (e.hasMoreElements ())
            //    ChessPiece p = (ChessPiece) e.nextElement ();
            //pcs.add ();
            //}  // still references the same objects!!
            pieces.trimToSize ();
            int size = pieces.size ();
            Object[] arr = new Object [size];
            Object[] initial = pieces.toArray ();
            System.arraycopy (initial, 0, arr, 0, size);
            for (int i = 0 ; i < size ; i++)
                ChessPiece p = (ChessPiece) arr ;
    pcs.add (p);
    pm.pieces = pcs;
    return pm;
    This all still does the same 'shallow cloning'...
    2) m.winter, my ChessPiece objects are not immutable - they have a co-ordinate field that
    changes as they are moved. This is for getting as called by another object, and for checking in
    the ChessPiece's own internal method for checking whether the passed-in square co-ordinate
    is a valid destination.
    Anyway, I don't think that's the main issue here. How can I properly clone/copy a Vector, resulting
    in :
    a) the original Vector
    b) a new, totally unrelated Vector.
    Thanks again all for your input.
    regards,
    lutha

  • Incorrect Legacyexchangedn is being stamped only on contact objects created on Exchange 2007

    Environment
    Exchange 2007- All mailboxes are hosted on Exchange 2007 servers.
    Exchange 2000 - Only being used to relay emails, RUS is running on these servers.
    Abnormality what i have noticed is that contact objects being created on exchange 2007 server are getting legacyexchangedn as "OU=itca" which is name of Exchange 2000 administrative group. Ideally, any objects created on Exchange 2007 should get
    legacyexchangedn like "OU=Exchange administrative group (FYDI....)" .
    This happens only with contacts. Legacyexchangedn on mailbox is getting stamped correctly.
    I am trying to understand why contact objects are getting incorrect legacyexchangedn. Any help on this would be appreciated. 

    Hi,
    Can you change the OU when create contacts?
    Please try below link to create contact, for your reference:
    https://technet.microsoft.com/en-us/library/aa997220(v=exchg.80).aspx
    Meanwhile, we can modify the default OU by AD. More details about Redirecting the users and computers containers in Active Directory domains, please refer to:
    http://support.microsoft.com/kb/324949/en-us
    Best Regards,
    Allen Wang

  • Differences between using a Object Reference and the Object itself

    Example:
    public class Myclass
    //difference between
    Myclass myobj;
    //and
    Myclass myobj = new Myclass();
    can anyone help me?

    Both lines you showed declare an object reference.
    The first one is not explictely assigned a value and
    is thus implicetly assigned the null reference (= a
    reference pointing to no object). The latter is
    initialized with an reference to the newly created
    Object (new Myclass()).
    They're both given a value of null first.
    The second one is then given a value that points to that object that was created.
    If they were inside a method, then the first one's value would be undefined.

  • Rmi and reference to remote object

    how I can obtain a reference to a remote object and not its value?

    This will happen automatically once it is exported and you return it from the server via an RMI call, e.g. Naming.lookup() or as the result of another remote method.

Maybe you are looking for