How do i use Vectors?

Hi,
I am getting a list of documents information from the db and to display them into html tables.The problem is how can i use Vectors to store the information so that i can list them using for loop?
String sql = "SELECT * FROM Document";
          System.out.println("manageUser.jsp sql: "+sql);
          ResultSet rs = db.ExecuteSQL(sql);
          if(rs.next()){
          name = rs.getString("Name");
               System.out.println("manageUser.jsp Name: "+name);
               title     = rs.getString("Title");
               System.out.println("manageUser.jsp Title: "+title);
               date     = rs.getString("DateEntry");
               System.out.println("manageUser.jsp Date: "+date);
               path     = rs.getString("Path");
               System.out.println("manageUser.jsp Path: "+path);
               docTypeNo     = rs.getString("DocumentType");
               System.out.println("manageUser.jsp docTypeNo: "+docTypeNo);
               comment = rs.getString("Comment");
               System.out.println("manageUser.jsp Comment: "+comment);
}

I'd load the values into a data structure and put those into the page scope for the JSP to pick up.
You can create a List of Maps, one Map per row, where each Map has the column name as the key and the SELECT result as the value. That'll let you iterate through to display the values in an HTML table in your JSP. - MOD

Similar Messages

  • How do I use the vector web forms??

    I'm new to using vector graphics and need to know how to go about using these web forms using Illistrator to make it functional on a web site. I tried opening it with the Illustrator, Fireworks, but not sure how to get the white fields to actually work like a text field. Hotpot will only link to another page which I don't want. I want the user to be able to enter their email address or whatever info is required then be able  to submit. Please help!

    That graphic is for making a wireframe/design. It cannot offer any real form functionality.
    To create a form with that appearance, you will need to wrestle with HTML, CSS, and your choice of scripting languages to process the input.

  • Need help on how to construct proper data structure using vector

    I have several data files need to be loaded to my application. The data file has only 2 columns: "mean" and "standard deviation". The data file is looking like following:
    mean standard deviation
    217.0 27.3
    312.1 31.5
    I used two vectors to store the mean data and standard deviation data.
    Vector meanVec = new Vector();
    Vector stdVec = new Vector();
    the file is loaded once a time. so how to make a vector of vector to store the data like a matrix?
    In another word, when multiple files need to be loaded, how can I keep track and store these data to display in two table (or files) which can display mean data from all the files and std from all files, like the following:
    table1 or file1
    mean1 mean2
    217.0 282.3
    table2 or file2
    std1 std2
    27.3 27.9
    Any suggestion is greatly appreciated!

    If your application doesn't require to keep track of which mean (or std.dev.) values come from which file, whatever you are doing is just fine.
    Use ArraList in place of Vector, as Vector being part of older collection framework is avoided in newer programs (as far as I know).
    While reading each file line by line in a loop, store the first value on each line in one list and the second value in the other. After reading all the files, you would have two lists containing the mean and std. dev. values.

  • How to use Vector or other ArrayList etc to store my JTree??

    How to use Vector or other ArrayList etc to store my JTree??
    Dear friends,
    I have following I posted before, but not get satisfactory answer, so I modify and repost again here.
    I have following code can add classes and students in the JTree,
    in class Computer Science, it has student Bill Brien,
    in Math, no,
    Then I I add Student Nancy, Laura, Peter into Computer Science Class,
    add AAAA, BBB, CCC into Math class,
    I create a new class called Chemistry, then I add DDD int Chemistry;
    so this JTree is dynamically changed,
    [1]. How can I dynamically save my current JTree with all above tree structure and its nodes in a Vector or ArrayList(not sure which one is best)??
    see code below:
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    public class ModelJTreeTest extends JFrame {
      private JTree tree;
      private DefaultTreeModel model;
      private DefaultMutableTreeNode rootNode;
      public ModelJTreeTest() {
        DefaultMutableTreeNode philosophersNode = getPhilosopherTree();
        model = new DefaultTreeModel(philosophersNode);
        tree = new JTree(model);
        JButton addButton = new JButton("Add Class/Students");
        addButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            addPhilosopher();
        JButton removeButton = new JButton("Remove Selected Class/Students");
        removeButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            removeSelectedPhilosopher();
        JPanel inputPanel = new JPanel();
        inputPanel.add(addButton);
        inputPanel.add(removeButton);
        Container container = getContentPane();
        container.add(new JScrollPane(tree), BorderLayout.CENTER);
        container.add(inputPanel, BorderLayout.NORTH);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(400, 300);
        setVisible(true);
      private void addPhilosopher() {
        DefaultMutableTreeNode parent = getSelectedNode();
        if (parent == null) {
          JOptionPane.showMessageDialog(ModelJTreeTest.this, "Select Class", "Error",
              JOptionPane.ERROR_MESSAGE);
          return;
        String name = JOptionPane.showInputDialog(ModelJTreeTest.this, "Add Class/Students:");
        model.insertNodeInto(new DefaultMutableTreeNode(name), parent, parent.getChildCount());
      private void removeSelectedPhilosopher() {
        DefaultMutableTreeNode selectedNode = getSelectedNode();
        if (selectedNode != null)
          model.removeNodeFromParent(selectedNode);
      private DefaultMutableTreeNode getSelectedNode() {
        return (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
      private DefaultMutableTreeNode getPhilosopherTree() {
        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Students");
        DefaultMutableTreeNode ancient = new DefaultMutableTreeNode("Computer Science");
        rootNode.add(ancient);
        ancient.add(new DefaultMutableTreeNode("Bill Brian"));
        DefaultMutableTreeNode math = new DefaultMutableTreeNode("Maths");
        rootNode.add(math);  
        DefaultMutableTreeNode physics = new DefaultMutableTreeNode("Physics");
        rootNode.add(physics);
        return rootNode;
      public static void main(String args[]) {
        new ModelJTreeTest();
    }the actual Tree dynamically created somehow looks like following:
                             |            1.Peter
                             |---CS---    2. Nancy
                             |            3. Laura
                             |            4.Brian
                             |
    Root(University): -------|---Math- 1.AAA
                             |            2.BBB
                             |            3.CCC
                             |
                             |
                             |---Chemistry- 1. DDDThanks a lot
    Good weekends

    you can't directly store a tree in a list.Ummm... Just to be contrary... Yes you CAN store a tree in a table.... In fact that's how the windows file system works.
    Having said that... you would be well advised to investigate tree data-structures before resorting to flattening a tree into a list.
    So... Do you have a specific requirement to produce a List? Your umming-and-erring about Vector vs ArrayList makes it sound like you're still at the stage of choosing a datastructure.
    Cheers. Keith.

  • How to use vector in JTable? Please help......

    Hi there
    I can use JTable using object array to manupulate data but it has a limitation of defining number of rows of the array. Alternatively i want to use vector. Anyone help me how to convert to using vector.
    Regards.
    mortoza, Dhaka

    hi,
    you could either use javax.swing.table.DefaultTableModel because this class uses a java.util.Vector for data storage or you could implements your own TableModel by extending javax.swing.table.AbstractTableModel.
    best regards, Michael

  • How can I use a vector image to stretch with the backgrounds in Muse master pages?

    How can I use a vector image to stretch with the backgrounds in Muse master pages?

    Maybe there's a bug.  I think it's only showing it when it wants to because look:

  • Can someone tell me how I can use a Vector to access my class?

    I wrote a class that will need to be instantiated with unknown instances later. I decided to use a Vector to do this. However when I created the vector:
    <CODE>
    Vector user = new Vector(1,1);
    user.addElement(Users());
    user.elementAt(0).name="Test";
    </CODE>
    I'm really not sure how I can set this. The class is of course Users and I want to set user as the Vector but specify Users as the Object Type. Any help? By the way I heard Java has a dynamic array feature is this true? I heard you had to use Vectors for Java. Also how can I free up the memory when I'm done with the class?

    Suppose class User looks like this:
    public class User
      public String name;
    }then you could do:Vector users = new Vector(1,1);
    users.addElement(new User());
    ((User)users.elementAt(0)).name="Test";BTW - Java is NOT C++, you always need to use the new keyword for object creation!

  • How do I use Illustrator to choose one vector image?

    I am new to Adobe Illustrator and the Creative Cloud.  How do I use Illustrator to work with vector images?

    Just about every tool in illustrator has to do with vector objects. So File>Open will open a vector file with a few exceptions. Illustrator can open a ai, pdf, eps, and I think svg file. The exception is both pdf and eps can be created by another program and can have data that is not recognizable and therefore may not open.
    I recommend that you take the time to read the manual, it provides a vast amount of information about how the tools work. Most book stores have books on illustrator.
    Also you can find a vast amount of information on the net about illustrator like the following.
    (free)
    http://creativesuitepodcast.com/
    http://kelbytv.com/
    http://tv.adobe.com/
    http://www.youtube.com/
    (pay)
    http://kelbyone.com/
    http://Lynda.com

  • How to define DefaultTableModel to use vector data?

    Hi ...
    I want to show files data in a jtable which consist of files (Name,size,path) I want to use vectors for remove and add methods. The problem is with data vector I tried to define it as
    Vector <Vector[][]>data;I get always an error when I tried to add data to data vector so where is my problem?
    Thanks.
    Feras

    Vector <Vector[][]>data;You are confusing 2Dimensional arrays with Vectors. When using Vectors you need to create a Vector of Vectors. The code should be something like this;
    Vector<Vector> data = new Vector<Vector>();
    Vector<Object> row1 = new Vector<Object>();
    row1.add(name);
    row1.add(size);
    row1.add(path);
    data.add(row);Presumably the code to add the rows would be in a loop.

  • Exception IndexOutOfBoundsException using Vector. Christmas homework!

    Hi everyone, I'm not a java expert (almost a newbie, I would say) and this is the first time I post anything in a Forum. I have the following piece of code:
    public class Test extends javax.swing.JFrame {
    private java.util.Vector list;
    public Test() {
         super("test");
         list = new java.util.Vector();
         javax.swing.JButton add = new javax.swing.JButton("Add");
         add.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent e) {
              String value = "new element";
              System.out.println("size: "+list.size());
              list.add(value);
              int i = list.size();
              System.out.println("size + 1: "+i);
              /**/System.out.println("elem i: "+ (String)list.get(i));
         getContentPane().add(add);
         pack();
         setVisible(true);
    public static void main(String[] args) {
         new Test();
    and when I run it I have the following printout:
    size: 0
    size + 1: 1
    java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
    at....
    (omissis)
    Does anyone have any idea of why? how can I solve the problem? Isn't Vector supposed to be "dynamic"?
    Elsewhere I use Vectors with no problems but I am not accessing it right after having added any element, rather I return it as the result of some elaboration and then access it.
    I know it's Christmas time and so I wish you all Merry Christmas and Happy new Year. I hope someone has time to answer me over this holydays.
    Thanks anyway,
    Rosario

    Does anyone have any idea of why? how can I solve the
    problem? Isn't Vector supposed to be "dynamic"?You try to access an element after the last element. When you set i = list.size(), i will be the index of the last element plus one. This is because indices count from 0.
    It is the list.get(i) that causes the problem.
    S&oslash;ren

  • How do I use shapes I create in Adobe Shape?

    All the shapes you create with Adobe Shape are stored in a CC Library.  This means you can access them in other desktop, mobile, and web apps.  Detailed instructions below.
    How to access your shapes in Creative Cloud
    Desktop: In order for this to work, you must have the most recent version of Illustrator and Photoshop.
    Open Adobe Illustrator on your desktop.
    Open the Libraries panel (Windows > Libraries)
    Your shapes should be present in your Libraries.  If you don’t see them there, select the libraries drop down to see if you saved your shapes in a different library.
    Now, you can drag the shape onto your canvas.
    At this point,  you can continue working with your shape, by adding editing.  Or, you can simply save the file.  Of course, after you save it to your desktop, you can email, post online, etc.
    Mobile apps:
    Open Adobe Illustrator Draw and open a drawing.
    Tap the Shapes icon to open the Shapes menu.
    Tap a library name to view the shapes in the Creative Cloud Library. Tap Change Library to select another library.
    Select your shape by tapping on it.
    Active Slide or Tocuh Slide. You can use Adobe Slide or Touch Slide to place the shape on the canvas. Access Touch Slide by tapping on the circular icon at the top of the menu bar.
    Place the shape.  Once you have activated Touch Slide, you will see a light rendition of your shape on the canvas.  Simply double tap on the shape outline to stamp the shape in place.
    Web:
    Navigate to https://assets.adobe.com/
    Select the Libraries menu item (left menu on the page)
    Select the desired library (if this is your first time using Libraries, you will only have one).
    This page provide a preview only.
    Also, here’s a great walk through video that may be useful: http://helpx.adobe.com/mobile-apps/how-to/shape-get-started.html?set=mobile-apps--fundamen tals--adobe-shape-cc

    I use Illustrator CC not Illustrator CC 2014 where can I find "Open the Libraries panel (Windows > Libraries)" and How can get the vector file from adobe shape cc?

  • Is there a way to "mix" colors using vectors?

    Here's my problem: I'm not a very technical and detailed artist, and I'm not trying to be. My works is pretty cartoonish actually, so I never dabble with the paintbrush and always use vectors. Anyhow, I was wondering, if I want to draw, using vectors, a guy with half of his legs in a pool, and half not, how would I go about coloring that? I mean, I'm intending to make the man pinkish, and the water light bluish, but how can I achieve the mixture, a combination of the two, for the half of the legs underwater? I'm not seeking color recommendations (for the legs) by the way. Is there a way to combine two colors to achieve an in-between ground?

    Put the legs on one layer and put the water on another layer above/in-front and adjust the opacity of the water-layer to let some of the leg-layer show through.  If you don't want to construct your cartoon using layers which is one of Photoshop's main benefits, you can figure out what color to make the wet leg with by creating a swatch of leg color in one layer and then make a water-colored layer in front/above it and adjust the opacity then use the eyedropper to sample the color of the combination.
    Of course in a real situation with the observer above the level of the water looking through it at an angle, the leg would become bluer the further into the water it went because there would be more water between the foot and the observer than say the knee and the observer and you'd want to make a gradient of color or gradient of transparency using a layer mask with a black-to-white gradient in the mask instead of just one opacity setting, and there would also be some size and offset of the leg due to refraction of the water, but as you said you're not a detailed artist.

  • How can I use this arrray?

    I have written arguemnts to add severals shapes to the scene(by using createVrmlFromString()), all the shape nodes stored in shapeArray[], now I'd like to use another array(b[]) to get the index of each shape nodes which has been added to the secne, so that I can record the their sequence.
    1. Can I use the arguments as following:
    shapeArray = {shape1,shape2,shape3.....}
    if(clickedButton = shape1)
    { b.add(shapeArray.indexof(0)); b++ }
    if (clickedButton = shape2)
    { b.add(shapeArray.indexof(1)); b++}
    2. Since the length of b[] is dynamically changed according to the number that the nodes added to the scene, shoudl I use the vector, how can I get the index of the shapeArray to a vector. should I use
    Vector b = new Vector;
    b.addElement(shapeArray.indexof(0));
    b++; //?

    I haven't used createVrmlFromString(), but maybe this will help...
    Note at Square, Circle, and Rectangle extends Shape.
    Shape[] shapeArray = { new Square(0, 0, 10, 10),
                                     new Circle(10, 10, 10),
                                     new Rectangle(20, 20, 150, 100)
    Vector clickedShapes = new Vector();
    // in the combobox listener
    clickedShapes.add(shapeArray(cb.getSelectedIndex()));
    // in the 'submit button' actionlistener; get first item
    Shape s = (Shape)v.get(0);
    [/code[

  • How to save a  vector art(for example, a circle) in a plugins?

    I want to write a plugin, and in it user can draw
    vector art, how to save this vector art in vector format ?

    If they need a vector object. Photoshop is not really the right program. Illustrator would be a better choice.
    In Photoshop the only formats that support vector are psd, pdf, and ai.
    Psd and pdf would create vector objects that would be more beneficial to someone using Photoshop.
    The ai format is the only true vector format that others can use. However it only exports paths and therefore can only be found in the paths panel. The issue is Photoshop does not apply a stroke or a fill to that path. If someone is not aware of that, they would think the document is blank.
    This file would have to be opened in illustrator and give the path a fill or stroke then save it.
    The reason pdf does not work as expected is the format supports both raster and vector objects. The creator of the file has to be very careful to use vector objects only. If you load the file into illustrator there is the possibility that it will not open. When illustrator saves a pdf it can embed an ai file into the pdf so it can open it. Photoshop can embed a psd file into a pdf but not an ai file. Illustrator requires the embedded ai in order to open the file.
    This is a long drawn out way to say Photoshop is not the right program, but it helps to understand why.

  • How to save a vector logo?

    hey, I am working on a Mac book pro, and using photoshop CC 2014. I'm making a company logo, and was asked for a vector of the logo. Does that mean its just on a transparent background and saved as a vector? If so, how do I save it as a vector? There's a lot of info in relations to a vector on google so I'm a bit confused. Thanks!

    If they need a vector object. Photoshop is not really the right program. Illustrator would be a better choice.
    In Photoshop the only formats that support vector are psd, pdf, and ai.
    Psd and pdf would create vector objects that would be more beneficial to someone using Photoshop.
    The ai format is the only true vector format that others can use. However it only exports paths and therefore can only be found in the paths panel. The issue is Photoshop does not apply a stroke or a fill to that path. If someone is not aware of that, they would think the document is blank.
    This file would have to be opened in illustrator and give the path a fill or stroke then save it.
    The reason pdf does not work as expected is the format supports both raster and vector objects. The creator of the file has to be very careful to use vector objects only. If you load the file into illustrator there is the possibility that it will not open. When illustrator saves a pdf it can embed an ai file into the pdf so it can open it. Photoshop can embed a psd file into a pdf but not an ai file. Illustrator requires the embedded ai in order to open the file.
    This is a long drawn out way to say Photoshop is not the right program, but it helps to understand why.

Maybe you are looking for