Creation of array

i m developing a web page using jsp in to which an array of strings is required
ie array of string to be created and then printed.

<%
     String[] string = {"S", "T", "R", "I", "N","G"};
     for(int d = 0; d < string.length; ++d){%>
          <%= string[d] %> br
%>
*/hehe... try lang.
<%
     String[] string = {"S", "T", "R", "I", "N", "G"};
     for(int d = 0; d < string.length; ++d){%>
          <%= string[d] %><br>
     <%}
%>
*/hehe... kulang ako.fascinating.
please, tell me more.Yun lang po. Bakit mali ba sagot ko?
Kulit mo!

Similar Messages

  • How to create an array in bpel?

    I am trying to integrate a web service into open-esb. The web service consumes an unbounded array of a "userInfo" data structure. The issue is that although I can create bpel to receive a message like this, due to type incompatibilities I need to create a different array within bpel to pass to the webservice.
    To date I have not found a way to create an array within open-esb's bpel. After extensive googling I have found that other ESBs define their own proprietary extensions to add nodes to an array.
    Thus I have two questions:
    First, does open-esb support creation of arrays? and if so, how do I create the array and add nodes to it?
    Second, and perhaps more importantly, is using an <assign> activity the best way to transfer a potentially large array from one variable to another (i.e., will it perform well)? Or should I use XSLT to transform the array from one wsdl type to another? And if XSLT is the answer, how can I do this within open-esb?
    Thanks in advance,
    Steve
    PS. Based on the various googlings Ive been doing this question seems to be frequently asked. If someone will help me find a solution I plan on writing a short "how-to" article for posting back to the community. Given that arrays are one of the most basic data structures I hope the article will be useful for others struggling with this issue.

    I think this is all covered in Steve-Nies other thread concerning this subject, entitled "Need help with BPEL please" (http://forum.java.sun.com/thread.jspa?threadID=5116270&tstart=0)

  • Metadata palette not separating array items

    This question may not be appropriate for this forum since it is not a JavaScripting question, but I have had no luck on the XMP SDK forum. I am asking about customizing the default Bridge metadata palette through the use of XML files stored in .../Custom File Info Panels/4.0/custom/.
    The very frustrating problem I'm having is that custom palettes do not seem to be capable of separating array items. If I enter Name 1; Name 2; Name 3 in a bag-defined property, the entire string is placed in the first array item, e.g. [1] "Name 1; Name 2; Name 3".
    The built-in sections of the metadata palette function normally. For instance, the IPTC Core section will create separate dc:subject array items if you enter Term 1; Term 2; term 3. I believe my XML file properly defines the array type, so I'm left wondering if XML custom metadata palettes don't support arrays or if this is a bug in Bridge.
    I was going to create a custom tabbed palette where I had more control of the creation of arrays, but the Script UI bugs in CS6, such as the vertical scroll bar problem, have eliminated that option. Users like the metadata palette because it is faster than opening the file info dialog, but if it does not support arrays, it is unusable.
    Any thoughts would be very welcome.
    Example XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmp_definitions xmlns:ui="http://ns.adobe.com/xmp/fileinfo/ui/">
    <xmp_schema prefix="dc" namespace="http://purl.org/dc/elements/1.1/" label="$$$/Custom/Schema/dc/Label=Dublin Core Elements"/>   
    <xmp_property prefix="dc" name="contributor" label="$$$/Custom/Property/dc/Contributor=Contributor" category="external" type="bag" element_type="text"/>   
    <xmp_property prefix="dc" name="publisher" label="$$$/Custom/Property/dc/Publisher=Publisher" category="external" type="bag" element_type="text"/>  
    </xmp_schema>
    </xmp_definitions>

    This question may not be appropriate for this forum since it is not a JavaScripting question, but I have had no luck on the XMP SDK forum. I am asking about customizing the default Bridge metadata palette through the use of XML files stored in .../Custom File Info Panels/4.0/custom/.
    The very frustrating problem I'm having is that custom palettes do not seem to be capable of separating array items. If I enter Name 1; Name 2; Name 3 in a bag-defined property, the entire string is placed in the first array item, e.g. [1] "Name 1; Name 2; Name 3".
    The built-in sections of the metadata palette function normally. For instance, the IPTC Core section will create separate dc:subject array items if you enter Term 1; Term 2; term 3. I believe my XML file properly defines the array type, so I'm left wondering if XML custom metadata palettes don't support arrays or if this is a bug in Bridge.
    I was going to create a custom tabbed palette where I had more control of the creation of arrays, but the Script UI bugs in CS6, such as the vertical scroll bar problem, have eliminated that option. Users like the metadata palette because it is faster than opening the file info dialog, but if it does not support arrays, it is unusable.
    Any thoughts would be very welcome.
    Example XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmp_definitions xmlns:ui="http://ns.adobe.com/xmp/fileinfo/ui/">
    <xmp_schema prefix="dc" namespace="http://purl.org/dc/elements/1.1/" label="$$$/Custom/Schema/dc/Label=Dublin Core Elements"/>   
    <xmp_property prefix="dc" name="contributor" label="$$$/Custom/Property/dc/Contributor=Contributor" category="external" type="bag" element_type="text"/>   
    <xmp_property prefix="dc" name="publisher" label="$$$/Custom/Property/dc/Publisher=Publisher" category="external" type="bag" element_type="text"/>  
    </xmp_schema>
    </xmp_definitions>

  • Time for creating big arrays

    Hi,
    My program needed to create several arrays with big size and I found a interesting phenomenon:
    int capacityI=13000000;
    time1=System.currentTimeMillis();
    int[] v1=new int[13000000];
    time2=System.currentTimeMillis();
    int[] v2=new int[13000000];
    long time3=System.currentTimeMillis();
    int[] v3=new int[13000000];
    long time4=System.currentTimeMillis();
    int[] v4=new int[13000000];
    long time5=System.currentTimeMillis();
    int[] v5=new int[13000000];
    long time6=System.currentTimeMillis();
    System.out.println(time2-time1);
    System.out.println(time3-time2);
    System.out.println(time4-time3);
    System.out.println(time5-time4);
    System.out.println(time6-time5);And following is an output of the program:
    15
    16
    16
    5625
    16
    it took much more time to create the fourth array and I could not find the reason. My program is a big program, It did many things before the execution of the above code. Was it related to the garbage collector? I meant the java system ran the garbage collection program before the creation the the fourth array. Was I right?
    I want to prevent this problem, i.e., decrese the time for the creation of arrays. Is there any way?
    Thanks.

    Note that your snippet of test code doe snot require the 5 arrays to be in memory at the same time and is hence not representing your later stated requirement to have them all available.
    Your locally created v1 array is not referenced anymore after creation and therefore eligible for garbage collection, be aware of that. Setting good initial and maximum heap size values as suggested by others is of importance here.

  • JDI events for array types (ArrayReference)

    What is the best way to get information on the creation of arrays (ArrayReference types). I have an application that needs to detect the creation of objects, set watchpoints on the variables of these objects and create an object based on this targetVM-object. I do this now through the MethodEntryEvent and check wether the method is a constructor. If so, I check the declaringType of the object AND set watchpoints on it's fields. This does not seem to work with array type objects however...
    I use a not-so-pretty workaround now where I check watchPointEvent for the type of the field that is altered. If it's of type ArrayReference, I create an array based on this ArrayReference, I have to do the same for locals at each stepEvent. Isn't there a better way. Do array types not use constructors so I could use the same way as for other objects (see first paragraph)?

    Pretty creative efforts! Unfortunately, array creation isn't done by constructors, it is done by bytecode instructions.
    Search for 'array' here: [http://www.javaworld.com/jw-12-1996/jw-12-hood.html] .
    I can't think of an easy way to do what you want. Can anyone else?

  • Array of generics (JLS seems too restrictive)

    Hi everybody,
    with some friends (in a lab) we currently develop a compiler generator
    (a la SableCC i.e SLR, LR, LALR).
    Because we start last june, we develop using jdk 1.5 and
    generics. For me, i think it save us lot of time mainly because
    Map<NonTerminal,Map<LRItem,Node>> is more readable
    than Map :)
    And this is my question : why CREATION of array of generics is unsafe ?
    I don't understand why a code like below is tagged unsafe :
    HashMap<State,Action>[] maps=new HashMap<State,Action>[5];
    for(int i=0;i<map.length;i++)
      maps=new HashMap<State,Action>();
    For me, the fact that JLS forbids array of generics creation
    is too restrictive, only cases where type parameter are lost
    should be tagged as unsafe.
    Example :
    Object[] array=maps; // unsafe
    Object o=map;            // weird but unsafe because
                                          // Object[] o=(Object[])(Object)maps; must be unsafeWhat do you think about this ?
    R�mi Forax

    The question is why :
    Future<Double>[] futures=new
    Future<Double>[10000];
    is not allowed. It seems safe !First of all, it would not be safe. The example below would exhibit exactly the same vulnerabilities with this assignment as it would with any of the allowed ones. This is because both the declared type and the runtime type would still be the same.
    It seems the current implementation is not able to detect (and warn about) the unsafety of the assignment above. That's why you're not allowed to use it: allowing it would provide a very false sense of type-safety
    and why :
    Object[] o=futures;
    is not tagged unsafe.
    It's unsafe because you can write :
    Object[] o=futures;
    o[0]=new Future<String>(); // for the example, let
    says Future is a class
    R�mi ForaxThis is probably done to avoid redundancy. As far as I can see, in all cases where this could be unsafe, you have been notified about the lack of safety already when you first assigned to futures.

  • Mathscript Array Generation Issue

    I am trying to create a script to generate a 2D array.  When I test the script in the Mathscript editor I get the correct answer, but when I implement it in my VI with the same numbers I get a different answer.
    Script:
    function final=grid(X,Xi,deltaX,Y,Yi,deltaY)
    s=X*Y;
    T=zeros(s,2);
    i=1;
    Yy=Yi;
    for k=1:X
    for j=1:Y
    T(i,1)=Xi;
    T(i,2)=Yy;
    Yy=Yy+deltaY;
    i=1+i;
    end
    Xi=Xi+deltaX;
    Yy=Yi;
    end
    final=T;
    Using the following grid(3,.5,1,3,.5,1) I get the answer I want
    ans =
               0.5      0.5    
               0.5      1.5    
               0.5      2.5    
               1.5      0.5    
               1.5      1.5    
               1.5      2.5    
               2.5      0.5    
               2.5      1.5    
               2.5      2.5    
    However I get a much larger matrix when I use it in my VI (attached).  Any help appreicated.
    Attachments:
    Array Creation.vi ‏24 KB

    The VI does not produce any errors and I have no broken arrow on my file.  I will re-attach the VI just in case I uploaded an earlier edition.   The issue is mainly that I am trying to produce the following array.
              0.5      0.5    
               0.5      1.5    
               0.5      2.5    
               1.5      0.5    
               1.5      1.5    
               1.5      2.5    
               2.5      0.5    
               2.5      1.5    
               2.5      2.5    
    However, when I run the code I get a 2 x 27 (Array Creation Pic)  array not a 2 x 9 (Array Generation Pic).
    Attachments:
    Array Creation.vi ‏73 KB
    Array Creation pic.PNG ‏76 KB
    Array Generation.PNG ‏81 KB

  • XSL transformation exception when using it in a subprocess

    Hi all
    I want to use a service task in sub-process that call a function with ref_cursor return type, when i map data association from output parameters to data object with xsl transformation an exception raise.
    in other hand my sub-process properties are : multiInstance, parallel , collection ,loop data input use an array , which create instances according to items of given array like http://www.avioconsulting.com/blog/simultaneous-creation-instances-array-oracle-bpm-11g
    by the way this feature works on service task that placed out of sub-process correctly.
    2.

    Hi Fazel,
    XSLT mapping is not working in the unpatched version of Oracle BPM 12c currently available.
    This work around is not great or even close to it, but the only way I've heard of anyone getting it to work is to right mouse click each of the individual children nodes.
    Know this bug has been reported by many people and has had a significant impact to all of us so it might be worth contacting Support to see if there might be a patch.
    Dan

  • Why does DataOutputStream write Boolean as 1 Byte?

    Im trying to conserve space in a file storing booleans.
    why does dataoutputstream write booleans as a byte?
    is there a way to write a bit only?
    thanks!

    Hi,
    A boolean does even allocate at least 8 bits when it is declared in the code.
    From the VM spec:
    "3.2.4 There Is No boolean Type
    Although Java defines a boolean type, the Java Virtual Machine does not
    have instructions dedicated to operations on boolean values. Instead, a
    Java expression that operates on boolean values is compiled to use the int
    data type to represent boolean variables.
    Although the Java Virtual Machine has support for the creation of arrays of
    type boolean (see the description of the newarray instruction), it does not
    have dedicated support for accessing and modifying elements of boolean
    arrays. Arrays of type boolean are accessed and modified using the byte
    array instructions.1
    For more information on the treatment of boolean values in the Java Virtual
    Machine, see Chapter 7, "Compiling for the Java Virtual Machine.""http://java.sun.com/docs/books/vmspec/html/Overview.doc.html#22909
    /Kaj

  • K8T Neo-FIS2R - raid 1 refused by Win2K

    Hi,
    I had K8T Neo-FIS2R for some time, working flawless. I had 1 ATA drive (Maxtor 120GB, 8MB) on a VIA controller. Then I decided to buy another similar one ATA HD, and create a raid 1 array (ATA+ATA) on Promise controler, with existing Win2K SP4 instalation.
    Everything went smoothly, creation of array and image on second HD. Then reboot, Windows start loading... and suddenly BSOD. Message: "If this is your first time seeing this message...check for viruses...corrupted HD...blah blah".
    Tried loading again and again - same situation.
    Then I discarded array, rebooted, and created it again. Same problems. And headache & rage.
    Few days later, I had a possibility to borrow a new SATA Maxtor 120GB drive, and try with ATA + SATA raid 1 combination. Done everything from the beggining, creating of array and image, at the end...again BSOD with the same message. 100% identical like in 2xATA combination.
    I thought that maybe the problem is in "original" ATA HD, so i tried with another combination: second (new) ATA HD from first situation (image of original HD was still on it, but with discarded array), anda SATA from second as a "slave" (so, this one is deleted in creating of this array). Same, same, same... Needless to say, at the end I tried with SATA as "master" and ATA as "slave". No progress.
    BIOS and all drivers were/are up-to-date. All HD`s work OK in a "no raid" situation, on both controllers.
    I have searched this forum, but didn`t find similar problem. If you have some ideas/suggestions/solutions, you will be a hero, for saving a one young man`s life
    Thanks in advance,
    Buca,
    Belgrade, Serbia

    Quote
    Originally posted by Tiresmoke
    Promise ATA raid can only work though the Promise ports which in the case of ATA or Ultra ATA drives would be IDE3 port. Then you must have Promise Raid turn on in the Pheriferals menu in Bios as well as set up under the Promise Raid section that will come up directly after post.
    You will need to read the Promise Ademdum manual that came along with the regular user manual for setup details.
    Thanks for trying to help, but I have done that all. I can create a raid array with ATA drives only on Promise...

  • Automatic array creation

    Hi,
    I am trying to build an array automatically by use of boolean array. I use for loop in the VI but when the boolean array false it assigned "0" into the array. I do not want to assign "0", instead of, I want to pass this step and assign when the boolean array element true. How could I do it?
    Egemen
    Solved!
    Go to Solution.
    Attachments:
    automatic array creation.vi ‏9 KB
    array assign.png ‏26 KB

    Use the Build Array in the TRUE case!
    Also, create an array constant and wire that into the shift register in order to initialize it.
    If you are this lost, you really should go through the LabVIEW 101 tutorials.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Conditional Build Array.png ‏15 KB

  • My generic array creation problem.

    I'm getting a "generic array creation" error on lines 6 and 14. I've googled it and I'm still having a hard time. Most things I find on it are pretty complicated and as you can see mine's not, I'm in a beginners course. I'm basically writing a class with methods for dealing with a file of donors.
    Here's my code:
    public class DonorList <dlist>
        //Create empty list
        public DonorList()
            storage = new dlist [MAX];
            count = 0;
        //Capacity as specified
        public DonorList (int cap)
            MAX = cap;
            storage = new dlist [MAX];
            count = 0;
        public boolean isEmpty()
            return count == 0;
        public void clear()
            count = 0;
        //Returns number of elements
        public int size()
            return count;
        //Item at position k, position starts at zero
        public dlist get (int k)
            if (k >= 0 && k < count)
                return storage [k];
            return null;
        // e becomes item at position k
        public dlist set (int k, dlist e)
            dlist old = null;
            if (k > 0 && k < count)
                    old = storage [k];
                    storage [k] = e;
            return false;
        //Returns the position of e or -1 if not found.
        public int indexOf (dlist e)
            int k;
            for (k = 0; k < count; k++)
                if (e.equals(storage[k]))
                    return k;
            return -1;
        //Appends e at the end of the list. Returns false on failure.
        public boolean append (dlist e)
            if (count < MAX)
                storage [count] = e;
                count ++;
                return true;
            return false;
        //Adds e at position k. Returns false on failure.
        public boolean add (int k, dlist e)
            int j;
            if (count == MAX || k < 0 || k > count)
                return false;
            for ( j = count; j > k; j--)
                    storage [j] = storage [j-1];
                    storage [k] = e;
                    count ++;
                    return true;
            return false;
        private int MAX = 100;
        private dlist [] storage;
        private int count;
    }Any help as to why I am getting these errors is very much appreciated. Thanks.

    You cannot create an array of a generic, instead you need to create an array of the class the generic extends (in this case Object)
    You then have to cast the array to the generic type which will give you an unchecked warning which you can turn off with @SuppressWarning("unchecked") on the class.
    Generics and arrays don't always play nicely together and this is one case. ;-)

  • Memory usage of big Array in sub-VI (was: Allow the creation of "Inplace"-VIs of Idea Exchange)

    Hi,
    this thread is based on my post in the LabVIEW idea exchange.
    I put my VIs in the attached .rar file.
    Regards
    Marc
    CLD
    Solved!
    Go to Solution.
    Attachments:
    Inplace_VI.ZIP ‏21 KB

    That would be a good explanation.  There was a thread on something very similar to this recently.  Can't remember exactly the topic but Daniel's answer certainly triggered some memories of a very similar discussion taking place.
    I think it had to do with LV assigning a Array created as a constant as Read-only so in order to make changes to it it needs to be copied to a new memory location, thus leaving the constant unchanged.
    I wonder how it performs in other LV versions.
    Shane.
    PS: Found the thread.  HERE.
    Message Edited by Intaris on 08-20-2009 03:23 AM
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • Array creation in generic method.

    I have next class.
    public class Data implements Comparable<Data>
        private int val;
        public Data(int val)
            this.val = val;
        public int getVal()
            return val;
       public void setVal(int val)
            this.val = val;
        @Override
        public int compareTo(Data o)
            return val - o.val;
    And I need create a duplicated array of Data object in a method which is a template with variable type
    public class CopyClass
        public static int[] duplicate ( int[] data)
            int array[] = new int [data.length * 2];
            for (int i = 0; i < data.length; i++)
                array[2*i] = data[i];
                array[2*i+1] = data[i];
            return array;
        public static<T extends Comparable<? super T>> T[] duplicate ( T[] data)
            T array[] = (T[])new Object [data.length * 2];
            for (int i = 0; i < data.length; i++)
                array[2*i] = data[i];
                array[2*i+1] = data[i];
            return array;
        public static void logg ( int[] data)
            String msg = "{";
            for (int d : data)
                msg += " " + d;
            msg += "}";
            System.out.println(msg);
        public static void main (String []args)
            int [] val = { 7, 14, 2};
            int [] vals = duplicate(val);
            logg(val);
            logg(vals);
            Data[] data = {new Data(7), new Data(14), new Data(2)};
            Data[] datas = duplicate(data);
    Firts duplicate method works fine because it has a integer array as parameter an return an array whom values are duplicated.
    Second duplicate methos don't works.
    { 7 14 2}
    { 7 7 14 14 2 2}
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Comparable;
      at analisis.utilidades.CopyClass.duplicate(CopyClass.java:30)
      at analisis.utilidades.CopyClass.main(CopyClass.java:60)
    Java Result: 1
    Who I can create this kind of objects arrays?

    T array[] = (T[])Array.newInstance(data.getClass().getComponentType(), data.length * 2);

  • Invoking the creation of an array with servlets

    I have a servlet that first creates an array of catalogue items that allows site users to add products to a shopping cart, obtaining information for each product from the catalog items array. Because I am forced in this scenario to declare the array first and create it later on in the code and cannot declare and create it at the same time, I have to allocate a size for it. e.g.
    private static CatalogItem items[] = new CatalogItem[60];
    However this is not very good as if a second site user invokes this array then there will be an out of bounds exception. Can anyone give me advice on how I can declare an array of certain size but not have it give out of bounds exceptions everytime it is invoked??
    by the way this is what I am trying to do, but it only allows the servlet to be invoked by one site user at the moment...
    private static CatalogItem items[] = new CatalogItem[60];
    while(rs1.next()){
                   // getInt or getString or getFloat etc to get the appropriate
              recordingidDB = rs1.getInt("recording_id");
              imageDB = rs1.getString("image_name");
              titleDB = rs1.getString("title");
              directorDB = rs1.getString("director");
              categoryDB = rs1.getString("category");
              durationDB = rs1.getInt("duration");
              ratingDB = rs1.getString("rating");
              yearDB = rs1.getString("year_released");
              priceDB = rs1.getFloat("price");
              items[i] =
                new CatalogItem
                  (recordingidDB,
                    titleDB,
                    directorDB,
                    categoryDB,
                    durationDB,
                    ratingDB,
                      yearDB,
                    priceDB);
              i++;          
         } //while rs1 endanyone??

    I'd look into an ArrayList or other Collection of some sorts so you can dynamicly expand / decrease the size.

Maybe you are looking for