Am i able to set a class object to session?

Hi,
i want to store some session data in a web application. I understand session can be set by this way:
session.setAttribute('student', name);
session.setAttribute('teacher', name2);
However the method above stores one a value in a session. I want to store many data in a session. I have code in this way for learning purposes. This is what i'm doing picking from bits and pieces from the internet. Please advise if whether i'm on the correct track.
I have a student class
public class Student {
    String name;
public String getName() {
          return name;     
public String setName(String name) {
          this.name = name     
I have a teacher class
public class Teacher{
      String name;
      public String getName() {
          return name;     
      public String setName(String name) {
          this.name = name     
I create a SchoolSessionBean class to store this object into a session
public class SchoolSessionBean {
       private Student student;
          private Teacher teacher;
       public SchoolSessionBean {
       public Student getStudent() {
         return student;
       public void setStudent(Student student) {
         student = student;
        public Teacher getTeacher() {
         return teacher;
       public void setTeacher(Teacher student) {
         teacher = teacher;
}Ok. Now i want this SchoolSessionBean class to store in a session. This SchoolSessionBean class also stores the data for the student and teacher.
Inside this class, this is what i coded to store the SchoolSessionBean into a session
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class createSession{
     Student student = new Student();
     Teacher teacher = new Teacher();
     student.setName("John");
     teacher.setName("Dave");
     HttpSession session = request.getSession();
     SchoolSessionBean schoolSessionBean = (SchoolSessionBean)session.getAttribute("schoolSessionBean");
     schoolSessionBean.setTeacher(student);
     schoolSessionBean.setUsagerDetails(teacher);
}I have not create the jsp but if on the jsp, can i get the session of the schoolSessionBean anywhere, on any page of the jsp and get the values from the student and teacher class using the codes below?
Can i use the codes below to retrieve the values of the names on any page of the jsp?
These codes are implemented on JSPS.
SchoolSessionBean schoolSessionBean = (SchoolSessionBean)session.getAttribute("schoolSessionBean");
String name1 = schoolSessionBean.getStudent().getName();
String name1 = schoolSessionBean.getTeacher().getName();Edited by: leeChaolan on Mar 24, 2009 9:11 AM

Oh i see. So if i want to set the class to a session, can i do it this way as shown below? I plan to try it tonight to see if it works. But just at the mean time, i like to seek some advice on my codes.
SchoolSessionBean schoolSessionBean = (SchoolSessionBean)session.getAttribute("schoolSessionBean");
     schoolSessionBean.setTeacher(student);
     schoolSessionBean.setUsagerDetails(teacher);Thanks

Similar Messages

  • Timer class object set time

    I want to be able to set the timer to a specfic time. How can I do that?
    ActionListener current = new CurrentTimeLabel(); Timer timer  = new Timer(60000, current); There are the objects;
    timer.start();
       timer.restart();
       timer.setInitialDelay();I want to be able to set the timer to a specific time, for example 5 seconds.
    timer.setTime(5000); If there is actually something that works like my fictional setTime() object that i just came up with to help describe my problem.

    There is nothing like that in the API notices. I can not believe they do not have that object ; that is , after the timer is running you can set the its current time.
    For example if I construct a Timer like the following;
    Timer timer = new Timer(60000, actionlistener);If the current time is 30000 and I want it to be 20000(meaning that the next action event does not get fired for another 40 seconds instead of the current 30 seconds) I should be able to set it to 20000.
    All I can do right now is stop the timer reset the initial delay and then start the timer again. The problem here is that while I am waiting for the timer to start again after setting the initial delay an action event does not get fired until the timer starts again.
    I have a timer set to be fired every 60 seconds. The problem involves is that I want it to be fired when the computer's clock reaches 00 seconds every time.
    What I have done is not to start the timer until the clock is set to 00 seconds. This works fine but over the long run the timer and the computer clock get out of synchroniztion(meaning the computer clock is 20 seconds and the timer is at 25 seconds; I need these to be the same all the time). What I have done right now is what I said above ; that is, every time an actionevent is fired is check and see if the computer clock and the timer are equal if they are not then I stop the timer set the inial delay to the difference in time and then start the timer again. Again this works but if there is a difference then while the timer is getting reset it misses one actionevent being fired. The timer is set to be fired every 60 seconds if there is a difference then on the next minute does not get fired because by setting the intial delay does not start the timer unitl the next minute, meaning the next minute does not have an action event fired when it should have been fired.
    The simple solution is to set the timer to a specific time. For example, if the clock is at 15 seconds and the timer is at 00 seconds while reset the timer to 15 seconds; that way an action event never gets missed while trying to reset the timer. It would be a simple object to program and have in that class but it does not exist for some reason. Is there someway I can add an Object .setTime() to the Timer class. So I can program timer.setTime(15000);.
    I am guessing only the Java people can add objects to the API classses.

  • Please help how to set/get a class object in hashtable or hashmap?

    Hi, everybody.
    I'd like to generate a class-object list in hashtable.
    However, compilation is error. Here is my code:
    Hashtable ht = new Hashtable();
    Class tmp_obj;
    tmp_obj = Class.forName("my_class_name_1");
    ht.put("my_class_name_1", tmp_obj);
    tmp_obj = Class.forName("my_class_name_2");
    ht.put("my_class_name_2", tmp_obj);
    Class selected_object = ht.get("my_class_name");
    ^here compilation error: incompitable types
    Could anybody tell me where is wrong in my code and how to
    correct it?
    Thank you in advance.
    Jeff

    Look at the javadoc for Hashtable. The get method returns an Object. You will need to cast it to a Class object.
    Class selected_object = (Class)ht.get( "my_class_name" );If you are using JDK5.0, then you should look up generics.

  • How to get a LabVIEW class object to expose an invoke-node method?

    Hi,
          I like the property/invoke-node "paradigm" used for interacting with "objects".  Can LabVIEW-class objects expose their properties and methods this way?  Can one or more LabVIEW-class objects be compiled into a library or "assembly" (or other distrubution format) that allows the property/invoke-node usage?
    I've looked at (but not completely understood) "Creating LabVIEW Classes".  Have also searched for related posts.
    The pic below shows an invoke node wired to a class with a Public VI "VAT.Status.Hello.vi".  I'd like to see VAT.Status.Hello show-up as a Method.  (I just tried "Select Method", and selected "VAT.Status.Hello.vi" but dialog's "OK" button stays greyed-out.)
    Cheers.
    Message Edited by tbd on 03-29-2007 03:15 PM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
    Attachments:
    VATStat.JPG ‏54 KB

    Hi Aristos,
          Thanks for the reply!  It was a bit dissappointing, though.
    It appears the LabVIEW-class object will be moving away from (what seems to me) a convenient object-interface presented by the invoke-node/method paradigm - which allows us to interface with a large set of "objects" (.NET, ActiveX, LabVIEW GUI, VISA Resource, ?) in a similar manner and independent of the object's origin.  Being able to read the methods and parameters that appear in these nodes is also helpful for understanding diagram logic!
    I do like the option of dropping a friendly "VI looking" icon on the diagram, but perhaps an optional - even default - VI-icon representation for a class-object invoke-node is feasible - so the LabVIEW class-object could be the more generic object first, but with a traditional-G representation(?)
    Given the answer "We would like, someday, to support the property node"
    and "in the next version of LV, wiring the LV class to the property/invoke nodes will break the wire so we'll avoid confusion in the future",
    ... I guess you'll break the wire in the next version, but (perhaps) allow it again - if support of the property node is ever implemented?
    Regards.
    P.S. For the record, huge THANKS to whoever it was that straightened-out enumerated-types (somewhere) between LV4.1 and LV6.1.  Every time I add or remove an enumeration in a typedef, I silently give thanks to the bright and thoughtful soul(s) who made this valuable tool work so well!
    Hello. This is your friendly neighborhood R&D guy for LabVIEW classes.
    Regarding your request about property and invoke nodes as relates to LV classes....
    Short story: We would like, someday, to support the property node. We have no intention of ever supporting the invoke node.
    Long story: As we were creating LV classes, we had to evaluate the right programming interface for these things. We wanted LV classes to behave as new data types in LV. A developer should be able to create a LV class, then give it to someone who doesn't even know OO programming, and that second programmer could use the new data type without learning a lot of new concepts. From this principle, we held fast to the idea that the programming interface should be subVI calls whereever possible. The invoke node is really nothing more than a VI minus the icon. If you want, you can popup on any subvi node and uncheck the option "View as Icon". This will make the node display in a way that has the terminals listed as text, like the invoke node. So, at the end of the day, the invoke node is simply a subroutine call in LV that is language dependent, as opposed to the language independent iconography of LV generally.
    The property node is a slightly different story -- the functionality of a property node is actually different than an invoke node as its terminals are various subsets of the properties available, not a fixed list of parameters like the invoke node. The property node provides a nice interface for setting multiple properties in a block and only having to check a single error return. Very friendly. Our intent is to allow you to create a VI that has 5 terminals: object in, object out, error in, error out, and either a single input or a single output of your chosen type. VIs with this conpane could be marked as "properties" of the class and would show up when you wire the class wire to the property node. We would call the subVIs behind the scenes as needed to get/set the properties.
    This is on the longer term roadmap because it is "syntactic sugar" -- it sweetens the programming style, but it is not necessary to program effectively. You can get the same effect by writing those same VIs and stringing them along on a block diagram "railroad track" style. We'll probably get around to it in three or four versions of LV -- there are some major user requests that impact functionality that have to get done first.
    PS -- in the next version of LV, wiring the LV class to the property/invoke nodes will break the wire so we'll avoid confusion in the future of people thinking there's a way to use these nodes.
    Message Edited by Aristos Queue on 04-02-2007 09:56 AM
    Message Edited by tbd on 04-03-2007 12:39 PM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Loading and viewing XML when a class object is created..Help Please

    Hello,
    I have writing a simple class which has a method that gets invoke when the object of the class is created. I am able to view the loaded XML content when I trace it with in my class method, but cannot assign the content to a instance variable using the mutator method. So the process goes like this:
    Class object is instantiated
    Class construtor then calls the loadXML method which laods the XML
    And then assigns the XML to a class instance variable.
    So now if I would like to access the loaded XML through class object, I should be able to see the loaded xml content which I am not able to see. I have spent over few hours and cannot get the class object to display the loaded XML content. I would highly appreciate it if someone can help in the right direction, please.
    [code]
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        public class Cars extends MovieClip {
               public var _CarList:Object;
               public function Quiz()
                  super();
                  loadCars();
    // ===========================================================
    //           CARS GETTER SETTER
    // ===========================================================
            public function set Cars(val:XML):void
                this._CarList = val;
            public function get Cars():XML
                return this._CarList;
    // ===========================================================
    //            LOAD QUESTIONS FROM XML
    // ===========================================================
            public function loadcars()
                var myXML:XML;
                var myLoader:URLLoader = new URLLoader();
                myLoader.load(new URLRequest("xml/cars.xml"));
                myLoader.addEventListener(Event.COMPLETE, processXML);
                function processXML(e:Event):void
                    myXML = new XML(e.target.data);  
                    Cars = myXML;                 // Assigning the loaded xml data via mutator method to the _CarList;
    //=============================================================  
                                  INSTANTIATING THE CLASS OBJECT
    //=============================================================
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        import com.as3.app.*;
        public class DocumentClass extends MovieClip {
            public var c:Car;
            public function DocumentClass()
                super();
                c = new Cars();  
                trace(c.Cars);
    [/code

    where you have:
                super();
                c = new Cars();  
                trace(c.Cars);
    c.Cars will not trace as the loaded xml, because it will not have loaded in time. After some time it should presumably have the correct value.
    loading operations in actionscript are asynchronous, so your nested function which is acting as the listener ( function processXML(e:Event):void) only ever executes when the raw xml data has loaded and that is (I believe, not 100% sure) always at least one frame subsequent to the current one.
    In general I would consider it bad practise to use nested functions like that, but I don't think its contributing to your issues here. I think its just a timing issue given how things work in flash....
    Additional observation:
    your Cars constructor calls loadCars() and your loadCars method is defined as:
    public function loadcars()
    I assume its just a typo in the forum that the uppercase is missing in the function name....

  • How to set Dnet assembly object instance

    I have an MKS Dnet MFC (P6AO) that I want to connect to.  I have been able to connect to other MFCs using my Vi as long as the input assembly instance is set to 14 and the output assembly instance is set to 19.  I can explicitly message this MFC.  What class, instance and attribute do I use to set this assembly object?  What is the data type?
    I can communicate with other brands of MFCs as long as the I/O assemblies are set to 14&19.  Any help would be appreciated.
    Thanks,
    Joe

    The ODVA has a freeware EDS editor that will go a long way toward preventing typos and incorrect settings, and allows you to try "what if" settings as you learn EDS details.  The specification for an EDS file is part of the ODVA CIP standard and as far as I know, costs $300, but you will be able to do a lot of simple things just by surfing through example EDS files.
    www.odva.org then search for "EZ-EDS".  They require a quick email registration first.
    Here's a valid link as of this writing:
    http://www.odva.org/Home/CIPNETWORKSPECIFICATIONS/Order/Software/tabid/134/Default.aspx

  • Creating New Class Object progmatically

    Instead of uploading an XML for a new type definition, I want to create a new class object progmatically.
    In my code, I basically set up a ClassObjectDefinition, set the attributes, then call createSchemaObject.
    I'm getting an exception saying that I have an invalid or missing option.
    What is the bare minimum needed to create a new Class Object?
    null

    First - you must be admin mode to create any subclasses. Minimally, you need to set:
    - ClassName
    - SuperClass
    - your custom attributes
    If you have created your own java class which is optional, you will need to set:
    - BeanClassPath
    Then there's optional settings such as Description.
    If this doesn't help, is it possible to post your code setting the ClassObject Definition attribute Values (AVs) and the create?
    As a guide, you should set all the AVs that you used to create a subclass via XML.
    Another note - once you create subclass named FOO, you will not be able to create another subclass named FOO.
    Another note (!): by default, iFS will use your class name to create the DBMS table. If you have a particularly long class name which will exceed the DBMS limits for table names, then you will want to set:
    - DatabaseObjectName
    hope this helps.
    -S
    null

  • Reading/Setting Process Data Objects from Java Spring Component or XSLT

    I have a BPMN process that references a Spring Component service.
    The Spring service has a Java class and within that class I'd like to be able to reference process data objects of the BPMN process.
    Ideally, I'd like to simply read and write to those objects within the Java class.
    However, if that's not possible, I don't I can set input parameters on the Java class and have it return an object.
    If I go that route, how can I pass in or return an object of a type other than your standard types (string, int, boolean)?
    For example, I have a data object that is a type I created based on a schema.
    How would I refer to that in a Java class?
    Hope that makes sense.
    Thanks,
    Mike

    Hi Adam.
    I'm a little confused on the order of operations.
    Here are the steps I took:
    1. In JDeveloper, I created two Java classes: one interface and one class that implements it. Initially, the one method takes parameters that are Strings. I want it to also take a data type that's defined in a schema.
    2. In the composite, drag Spring Context component onto screen. This opens the XML and here I define the <bean> that points to the two Java classes I just created.
    3. In the composite, I create a pointer from the Spring component to Exposed Services and I create a new service, which creates the WSDL.
    4. Now I edit the WSDL to import the schema that defines the type I want.
    5. In my BPMN process, I add a call to the service I just created. For Data Associations, it recognizes the changes I made to the WSDL and I can map input variables to the new type added in step 4.
    Here's where I'm stuck. In the actual Java class, I don't know how to add the parameter for the data type I created. Where is this Java object created?
    Thanks,
    Mike

  • Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1

    I am trying to build a component which has the ability to instantiate and execute
    an known EJB method on the fly.
    I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
    I know that the EJB I am trying to invoke is deployed and available on the server,
    as I can see it in the console, I also seen to have been able to get the remote
    interface of the object, my problem occurs when I try and access the class object
    so I can perform a create on the object and then execute my method
    The code I have written is below:
    private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
    throws Exception {
         String homeCreate = "create";
         Class []homeCreateParam = { };
         Object []homeCreateParamValues = {};           
    try {  
    //This call seems to work and doesn't throw an exception     
    Object home = pCtx.lookup(pJNDIName);
    //However this call throws a java.lang.ClassNotFoundException
    Class homeBean = Class.forName(pHomeBean);
    Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    } catch (NamingException ne) {             
    logStandardErrorMessage("The client was unable to lookup the EJBHome.
    Please make sure ");
    logStandardErrorMessage("that you have deployed the ejb with the JNDI
    name "+pJNDIName+" on the WebLogic server ");
    throw ne;
    } catch (Exception e) {
    logStandardErrorMessage(e.toString());
    throw e;     
    Any advice would be really appreciated, I'm fast running out of ideas, I suspect
    it has something to do with the class loader but I'm not sure how to resolve it
    Regards
    Jo Corless

    Hello Joanne,
    Congratulations! I'm very happy that you've managed to fix your problem. It's
    always essential to understand how to package applications when deploying on BEA
    WebLogic. Usually, by throwing everything into an EAR file solves just about all
    the class loader problems. :-) Let us know if you have any further problems that
    we can assist you with.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Joanne Corless" <[email protected]> wrote:
    >
    >
    I've fixed it!!!!!!!!
    Thanks to everyone who gave me help!!!!
    The class loader was the culprit which is what I suspected all along.
    As soon
    as I put the 2 jar files I was using into an EAR file the problem went
    away!!!!!
    Thanks again
    Jo Corless
    "Ryan LeCompte" <[email protected]> wrote:
    Hello Joanne,
    As Mr. Woollen mentioned, I also believe it's a problem with the class
    loader.
    You need to be careful how you arrange your EJBs, because WebLogic has
    a specific
    method in which it loads classes in an EAR, JAR, and WAR file(s). Please
    refer
    to http://dev2dev.bea.com/articles/musser.jsp for more information about
    BEA WebLogic
    class loading mechanisms and caveats. Also, try printing out the various
    methods
    that are available on the object that was returned to you via reflection.
    For
    example, use the getMethods() method, which returns an array of Method
    objects
    that you can subsequently cycle through and print out the various method
    names.
    This way you can discover if the class found/returned to you is indeed
    the one
    you intend to locate.
    Hope this helps,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    Rob Woollen <[email protected]> wrote:
    I believe the issue is the home interface class for this EJB is not
    available in the class loader which is doing the reflection.
    If you do:
    getClass().getClassLoader().loadClass(homeInterfaceClassName)
    I suspect it will fail. Reflection still requires that the class be
    loadable.
    -- Rob
    Joanne Corless wrote:
    Hi Slava,
    If I make my code look like you describe below I get a compliationerror telling
    me that
    home.getMethod() is not recognised (no such method)
    If I change it slightly and use
    Method homeCreateMethod =
    home.getClass().getMethod(homeCreate,homeCreateParam);
    The code will compile OK but when executed it still throws a NoSuchMethodException
    Any ideas ?
    Thanks for your help so far
    Regards
    Jo Corless
    Your code should look like
    Object home = pCtx.lookup(pJNDIName);
    Method homeCreateMethod =
    home.getMethod(homeCreate,homeCreateParam);
    return homeCreateMethod.invoke(home, homeCreateParamValues);
    Regards,
    Slava Imeshev
    "Joanne Corless" <[email protected]> wrote in message
    news:[email protected]...
    Hi Ryan,
    I also wanted to mention that if you do a "header search" in this
    particular
    newsgroup
    with the search query as "reflection", you will see many previousmessages
    regarding
    reflection and EJBs. I believe you could learn a lot from thedifficulties
    that
    others have faced and solved.I tried that and although there was a number of similar cases noneof them
    actually
    seem to fix my issue. Thanks for the suggestion though
    Are the EJBs that you are trying to access accessible via your
    system
    classpath?
    Try to avoid having them accessible via the main system classpath,and
    only bundle
    them in your appropriate EJB jar files (contained in an EAR file,for
    example).Maybe I should have laid the problem out a little clearer.
    I have a number of EJB's bundled up in a JAR file which is hot deployedto
    the
    server. Within this first JAR file is an EJB (SSB) component that
    needs
    to
    be
    able to invoke a known method on another EJB. This second EJB may
    or
    may
    not be
    within the first JAR file but it also will be hot deployed.
    The component trying to invoke the method on the 2nd EJB has to
    be
    able to
    create
    an instance of the 2nd EJB without actually knowing anything bar
    a
    JNDI
    Name which
    is passed in at runtime.
    I can get as far as doing the
    Object home = pCtx.lookup(pJNDIName);
    This returned a class with the name
    "com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
    Impl_WLStub"
    My problem seems to occur when I try and invoke the create method
    Method homeCreate = home.getClass().getMethod("create", new Class[0]);
    My code throws a java.lang.NoSuchMethodException at this point so
    I
    am
    unable
    to progress to the next step of :
    Object bean = homeCreate.invoke(home, null);
    So I can return the instantiated bean back to the calling client.
    Why am I getting the NoSuchMethodException, is is because I am gettinga
    stub
    back rather than the home interface and if so how do I get the truehome
    interface
    from the bean
    Thanks in advance
    Jo Corless

  • How to use two activex class objects in same vi

    HI
    I am using labview to read ECU data from INCA software .INCA providing COMTOOL API(incacom.dll). I am using ACTIVEX for  communication between INCA & Labview. My problem is If I have used single activex class object  I am able to read Inca version, getting the database path etc. If I have used two activex class in same vi (one to open Inca & other one is to read the folder structure) I am not getting output.I have attached snapshot for referance
    Attachments:
    activex1.JPG ‏114 KB
    activex2.JPG ‏107 KB

    It wasnt in the first two images you posted, or I couldnt see it anyway! That was the only reason.
    Did you try the database block on its own, just to confirm that it is working?
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • How can i add custom attributes to a new Class Object using the API ?

    Hello everyone,
    Here is my problem. I just created a subclass of Document using the API (not XML), by creating a ClassObjectDefinition and a ClassObject. Here is the code :
    // doc is an instance of Document
    ClassObject co = doc.getClassObject();
    ClassObjectDefinition cod = new ClassObjectDefinition(ifsSession);
    cod.setSuperclass(co);
    cod.setSuperclassName(co.getName());
    cod.setName("MYDocument");
    ClassObject c = (ClassObject)ifsSession.createSchemaObject(cod);
    Everything seems to be OK since i can see the new class when i use ifsmgr. But my question is : how can i add custom attributes to this new class ? Here is what i tried :
    AttributeDefinition value = new AttributeDefinition(ifsSession);
    value.setAttribute("FOO", AttributeValue.newAttributeValue("bar"));
    c.addAttribute(value);
    But i got the following error message :
    oracle.ifs.common.IfsException: IFS-30002: Unable to create new LibraryObject
    java.sql.SQLException: ORA-01400: impossible d'insirer NULL dans ("IFSSYS"."ODM_ATTRIBUTE"."DATATYPE")
    oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewSchemaObject(oracle.ifs.server.S_LibraryObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.NewSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.createSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    void fr.sword.ifs.GestionDocument.IFSDocument.createDocument(java.lang.String)
    void fr.sword.ifs.GestionDocument.IFSDocument.main(java.lang.String[])
    So, what am i doing wrong ?
    More generally, are we restricted in the types of the attributes ? (for example, would it be possible to add an attribute that would be an inputStream ? Or an object that i have already created ?).
    Any help would be appreciated. Thanks in advance.
    Guillaume
    PS : i'm using Oracle iFS 1.1.9 on NT4 SP6 and Oracle 8.1.7
    null

    Hi Guillaume,
    you're welcome. Don't know exactly, but assume that ATTRIBUTEDATATYPE_UNKNOWN
    is used to check for erronous cases only
    and it shouldn't be used otherwise.
    Creating your own objects could be simply done via
    ClassObject ifsClassObject;
    DocumentDefinition ifsDocDef = new DocumentDefinition(ifsSession);
    // get class object for my very own document
    ifsClassObject = ClassObject.getClassObjectFromLabel(ifsSession, "MYDOCUMENT");
    // set the class for the document i'd like to create
    ifsDocDef.setClassObject(ifsClassObject);
    // set attributes and content for the document...
    ifsDocDef.setAttribute("MYFOO_ATTRIBUTE",....);
    ifsDocDef.setContent("This is the content of my document");
    // create the document...
    PublicObject doc = ifsSession.createPublicObject(ifsDocDef);
    null

  • What is the advantage of using IB to create XIBs/Class Objects over coding?

    Hi all,
    I hoping someone can provide me some pros and cons as to when I should use IB to create XIBs and/or class objects as opposed to directly coding them.
    For example, if I choose Apple's Template for creating a Navigation Based Application (cocoa touch), the project creates two NIB files - MainMenu and RootViewController.
    However looking at one of demo apps SimpleDrillDown, it does not have a RootViewController XIB and instead creates it via code.
    Another example from the same two apps is that the template generates a "Navigation Controller" class object in the Mainmenu.xib. SimpleDrillDown does not bother with this in the XIB, but uses code to generate the controller:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Create the navigation and view controllers
    RootViewController *rootViewController = [[RootViewController alloc] init];
    UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    self.navigationController = aNavigationController;
    [aNavigationController release];
    [rootViewController release];
    // Configure and show the window
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    as opposed to the template which only needs this:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Configure and show the window
    // Navigation Controller is defined in MainWindow.xib
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    So what are the advantages of each approach. Why does apple suggest one approach and yet all its demos use another.
    Any thoughts, answers gratefully received.
    TIA, Michael.

    You can do whatever you're comfortable with, but most of the best Cocoa programmers--the ones on the Mac, I mean--recommend putting everything you can into Interface Builder.
    It's a little like the difference between writing a program to do a bunch of financial calculations and using a spreadsheet. Yeah, the program can do everything the spreadsheet can--and more besides--but you'll find it far easier to create, use and modify the spreadsheet.
    Interface Builder takes away a lot of completely meaningless choices ("What order should I create the objects in? How should I name the variables? How should I create their frames? What order should I set the attributes in?"), leaving you with an interface optimized for creating and arranging objects, and allowing your code to focus on what you really do need to think about--your application's logic.
    (By the way--part of the reason Apple's demos don't all use Interface Builder is that the very first SDK releases didn't have it. Back then, you had to create all your views programatically. Believe me, I have no wish to go back to setting autoresize masks manually. Now get off my lawn, whippersnapper.)

  • How to set property classes at runtime.

    Well, as the subject line says my question is plain and simple. I don't see any property for this in SET_ITEM_PROPERTY built-in.
    Currently a form has 10 subclassed blocks and views. These blocks have almost similar/definite number of items. At a time only one block with its canvas will be shown to the user. Instead of using so many sub-classed objects, I would like to use only one block and canvas. Now I am looking get getting just property classes from the 10 child forms, which I am looking forward to apply to the common block and items. Any other ideas for the same also appreciated.
    Thanks,
    -- Raam.

    alsalamu alykom
    I think there is no way to set property classes at runtime.
    u must loop through the objects

  • How to automate the creation of Function Module & Class Object (SE24)

    Experts,
    I have the requirement to automate the creation of any type of programs: ie function module (like how we normally create in SE37 together with the parameters), class object (like how we normally create in SE24 together with attribute & method), normal report (like how we did in SE38), module pool and so on.
    For example. I backuped my program into a flat file (the entire source code in txt formal or HTML) through a download program and I need to upload back this flat file into another installation of SAP.
    Does SAP provide any predefined FM to cater for the above cases or better still, does anyone know of any upload program which I can use for the above requirement.
    Thanks in advance.

    Hi Kris, I can't use the transport system as these are 2 separate SAP installation in a different place. The requirement came in the form of creation of program to be able to generate FM/Class/Report on the go.

  • Safe to synchronize on Class object?

    Is it considered safe and good practice for a method to synchronize on the Class object of it's own class? I am using lazy initialization for a static field; the field is initialized to null when the class is loaded and then set to its actual value the first time it is used. I need to make sure the actual initialization is thread safe. Here is a simplified example of what I am doing.
    public class Test {
        private static String myField = null;
        public String foo() {
            synchronized (Test.class) {
                if (myField == null) {
                    myField = "Hello world!";
            return myField;
    }It seems like that should work, but I was a little worried that by locking the Class object I might cause a problem with the class loader or something.

    jschell wrote:
    Nick_Radov wrote:
    I have to use lazy initialization rather than initializing the static field in clinit because it's value depends on a superclass field which isn't fully available until the class loader finishes loading the class. So the lazy initialization is just to get around that sequencing problem.Huh? That is certainly phrased oddly at best. If a "superclass" is used then it is fully loaded before it is used. There is no sequencing problem with that.He might have a design problem. He can se a partly initialized super class if that method is overridden and invoked by the parent constructor.
    Kaj

Maybe you are looking for