Iterating through records

I am trying to iterate one by one through a resultset and populate the textfields with the data. It brings in the first record in the database and the last. However it wont bring in the middle one. Here is a copy of the source code.
try
con= DriverManager.getConnection(url,"app","app");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
querynext= "Select * from CoffeeSuppliers";
results = stmt.executeQuery(querynext);
String nextID="";
String nextName = "";
String nextAddr = "";
String nextCity= "";
String nextState= "";
String nextzip= "";
String output ="";
while(results.next())
nextID= results.getString(1);
nextName= results.getString(2);
nextAddr= results.getString(3);
nextCity= results.getString(4);
nextState= results.getString(5);
nextzip = results.getString(6);
comp_ID.setText(nextID);
comp_Name.setText(nextName);
comp_Addr.setText(nextAddr);
comp_City.setText(nextCity);
comp_State.setText(nextState);
comp_zipcode.setText(nextzip);
}//end the while
con.close();
stmt.close();
catch(SQLException sqlex)
System.err.println("ERROR: " + sqlex.getMessage());
}// end the if statement
}// end the actionPerformed function
Any feedback will be great.

Hi,
Model for
Getting Records from DB in Servlet - Store into Bean - Add to ArrayList and set to access - Via Jsp Display the Records.
//Bean File
public class ProductBean
     public String pname          = null;
     public int totalqty          = 0;
     public int pid               = 0;
     public ProductBean(){}
     public ProductBean ( int pid, String pname,  int totalqty )
     this.pid           = pid;
     this.pname           = pname;
     this.totalqty      = totalqty;
     //setter methods
     public void setPid(int pid) { this.pid= pid;     }
     public void setPname(String pname){ this.pname = pname; }
     public void setTotalqty(int totalqty){ this.totalqty = totalqty; }
     //getter methods
     public int getPid() { return pid; }
     public String getPname() { return pname; }
     public int getTotalqty() { return totalqty; }
//Servlet File
public void doPost ( HttpServletRequest req, HttpServletResponse res ) throws ServletException,IOException
          res.setContentType ( "text/html" );
          ArrayList al     = al = new ArrayList ();
          ProductBean pb = null;
          ResultSet rs   = null;
          HttpSession hs     = req.getSession (true);
          try
               //connection statements
          Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE );
          rs = stmt.executeQuery ( "select pid,pname,ptotalqty from producttable order by pid" );
          while ( rs.next () )
          pb = new ProductBean ( rs.getInt(1), rs.getString (2), rs.getInt (3) );     // passing all values to bean
          al.add ( pb );                                            // add into arrayList
          pb = null;
          //set that final ArrayList
          hs.setAttribute ( "al", al );
          rs.close ();
          res.sendRedirect ( "./Displayproduct.jsp");
          catch ( SQLException e )
               out.println ( e.getMessage () );
     //Jsp file
     <%
     //displaying Records
     ArrayList al     = new ArrayList();
     ProductBean pb     = null;
     al = (ArrayList) session.getAttribute ( "al" );
          for ( int i = 0; i < al.size(); i++ )
          pb = (ProductBean) al.get(i);
          out.println( pb.getPid () + " " + pb.getPname() + " " + pb.getTotalqty() +"<br>");
     //set session al to null
     session.setAttribute ( "al", null );
     pb = null;
     %>               *************************** Now you to Modify ***********************

Similar Messages

  • Iteration through records in E-Tester

    Hi,
    I am testing a web application and I would like to know if there is a way to iterate through records without logging in and logging out multiple times. Right now when I iterate , each ietration starts with login and ends with logout. I want to be able to iterate through just the business process multiple times and logout at the end.
    Can this be done in e-tester.
    Thanks.
    Message was edited by:
    user643041

    You can do this with Job Scheduler. You will have to break up the scripts into their component parts then run everything together in Job Scheduler.

  • Iterating through RWBTreeOnDisk

    Is there any way to Iterating through RWBTreeOnDisk, My problem is that i have 100 records in RWBTreeOnDisk and i want to fetch only first 20 records, how should i proceed to do the same, instead of getting all the records using applyToKeyAndValue(), i need to fetch particular number of records in the tree.
    Plz suggest me the way to proceed.
    Thanx

    We use sqlite for this sort of application. It gives you the power of sql but acts on files directly rather that via a server. see www.sqlite.org

  • Pass-through recording with Canon ZR25

    I have an older Canon ZR25.  Is it capable of pass-through recording from a VCR?  I can plug the VCR to the camera, and the camera to the computer via the firewire, but can't get anything to work.  Is my only option to actually record the VCR tape on the mini DV tape in the camcorder first, then transfer that to the computer?

    Hi Miniviolet,
    For assistance with this, please contact us here.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • SharePoint Online Iterating through Document Libraries CSOM

    Hi,
    I am trying to iterate though a document library and set each document/items whithin to inherit permissions (at the moment each doc/item is using uniquer permissions).
    I am able to get the specific document library that I am interesting in, however I cannot at the moment iterate though each of the items/documents within it, but here is what I have so far:
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.Runtime.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Linq.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.dll"
    $webUrl = "https://test.sharepoint.com/sites/testsite"
    $username = "####"
    $password = "####"
    $securePass = ConvertTo-SecureString $password -AsPlainText -Force
    $listname = "TestDoc";
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
    #variables
    $web = $ctx.Web
    $lists = $web.Lists
    $ctx.Load($lists)
    $ctx.Load($web)
    $ctx.ExecuteQuery()
    #print web URL
    write-host `n "Web Url:" `n $web.Url
    foreach ($list in $lists)
    if ($list.Title -eq "TestDoc")
    #print list name if found
    write-host `n "Found the list:" `n $list.Title `n
    #attempting to iterate through items in the document library
    foreach ($item2 in $list.Items)
    #list the items/documents in the document library
    write-host $item2.Title
    It is the foreach loop I am having trouble at the moment as I am not sure how to loop though each of the items/documents in the document library.
    Any suggestions on the approach I should take would be much appreciated.

    Thanks for the heads up, I have re-worked my script which is simpler and now works like a charm:
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Client.Runtime.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.Linq.dll"
    Add-Type -Path "Libraries\Microsoft.SharePoint.dll"
    $webUrl = "https://test.sharepoint.com/sites/testsite"
    $username = "####"
    $password = "####"
    $securePass = ConvertTo-SecureString $password -AsPlainText -Force
    $listname = "TestDoc"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass)
    #get the List/DocLib and load it for use
    $listUpdate = $ctx.Web.Lists.GetByTitle($listname)
    $ctx.Load($listUpdate)
    $ctx.ExecuteQuery()
    #CAML Query to get all items inclusing sub-folders
    $spQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
    $spQuery.ViewXml = "<View Scope='RecursiveAll' />";
    $itemki = $listUpdate.GetItems($spQuery)
    $ctx.Load($itemki)
    $ctx.ExecuteQuery()
    #iterating through the items and reseting permission inheritence
    for($j=0; $j -lt $itemki.Count; $j++)
    $itemki[$j].ResetRoleInheritance()
    $ctx.ExecuteQuery()

  • PO Upload through recording

    Hello All,
    I m writing upload program for PO through recording (SM35). I m facing problem at item level. I have hundred of items to upload. At item level grid there is no button like 'Insert Row'. In actual screen it is done through scroll bars of grid. It generates BDC_Code of Enter/Return. But when I run this recording (or generated program) even in SM35 it doesn't write records more than that of grid rows (visible rows) and gives error message that material group column is not writable. Actually it doesn't consider scroll bar pressing as new record entry in recording and tries to overwrite on last row that is already written. If I give row no greater than that of visible rows, it gives error. I have no problem for Condition entries because 'Insert Row' button is available there.
    Please tell me how I should handle this problem in recording?
    Regards
    Nadeem

    Hi Nadeem,
    I don't know on what release you are on. But BAPI_PO_CREATE1 does have the possibility of adding conditions. Furthermore, as far as I know, you can use an arbitrary package number just to relate the PO-item and the relevant Services. Just start with '0000000001' for the first PO-item and add 1 for any next item.
    The checks executed during screen processing should be the same  when executing using a BAPI.
    Regards,
    John.

  • Avoid iterating through everything

    Hello all,
    Hope you guys can help me with this problem. I have a program that draws anywhere from 1-300,000 letters on a canvas. Each letter is created from a class called StringState which extends Rectangle. What I would like to do is have each letter respond when the user moves the mouse over the letter by growing bigger. I figured I can just see if the letters bounds contains the point where the mouse moved to and if it does change the letters size and repaint around that letter to update the display. This works great from 1-5000 letters but getting up to 10,000 or even higher creates a very visible lag while the program is iterating through the letters to check if the mouse location intersects the letters bounds. What I was wondering is there a way to get this result without iterating through the entire collection of letters to see if it contains the mouse location? Like can I attach some kind of mouse listener to each letter or something like that? The following program just demonstrates how I create and display the letters I haven't really had a chance to create a demonstration of how they would grow when hovered over. The program i'm working on that actually demonstrates this is very large and hard to trim down to show an example so the following code is actually from a previous question I asked and was provided by Aephyr. Thanks in advance for your guys help :)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.util.List;
    public class PaintSurface implements Runnable, ActionListener {
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new PaintSurface());
         Tableaux tableaux;
         Random random = new Random();
    //        Point mouselocation = new Point(0,0);
         static final int WIDTH = 1000;
         static final int HEIGHT = 1000;
            JFrame frame = new JFrame();
         public void run() {
              tableaux = new Tableaux();
              for (int i=15000; --i>=0;)
                   addRandom();
              frame.add(tableaux, BorderLayout.CENTER);
              JButton add = new JButton("Add");
              add.addActionListener(this);
              frame.add(add, BorderLayout.SOUTH);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(WIDTH, HEIGHT);
              frame.setLocationRelativeTo(null);
    //                frame.addMouseMotionListener(new MouseListener());
              frame.setVisible(true);
         public void actionPerformed(ActionEvent e) {
              addRandom();
         void addRandom() {
              tableaux.add(
                        Character.toString((char)('a'+random.nextInt(26))),
                        UIManager.getFont("Button.font"),
                        random.nextInt(WIDTH), random.nextInt(HEIGHT));
    //        class MouseListener extends MouseAdapter {
    //            public void mouseMoved(MouseEvent e) {
    //                mouselocation = new Point(e.getX(),e.getY());
    //                frame.repaint();
            class StringState extends Rectangle {
                    StringState(String str, Font font, int x, int y, int w, int h) {
                            super(x, y, w, h);
                            string = str;
                            this.font = font;
                    String string;
                    Font font;
            class Tableaux extends JComponent {
                 Tableaux() {
                      this.enableEvents(MouseEvent.MOUSE_MOTION_EVENT_MASK);
                      lagState = createState("Lag", new Font("Arial",Font.BOLD,20), 0, 0);
                 protected void processMouseMotionEvent(MouseEvent e) {
                      repaint(lagState);
                      lagState.setLocation(e.getX(), e.getY());
                      repaint(lagState);
                      super.processMouseMotionEvent(e);
                 StringState lagState;
                    List<StringState> states = new ArrayList<StringState>();
                    StringState createState(String str, Font font, int x, int y) {
                        FontMetrics metrics = getFontMetrics(font);
                        int w = metrics.stringWidth(str);
                        int h = metrics.getHeight();
                        return new StringState(str, font, x, y-metrics.getAscent(), w, h);
                    public void add(String str, Font font, int x, int y) {
                         StringState state = createState(str, font, x, y);
                            states.add(state);
                            repaint(state);
                    protected void paintComponent(Graphics g) {
                            Rectangle clip = g.getClipBounds();
                            FontMetrics metrics = g.getFontMetrics();
                            for (StringState state : states) {
                                    if (state.intersects(clip)) {
                                            if (!state.font.equals(g.getFont())) {
                                                    g.setFont(state.font);
                                                    metrics = g.getFontMetrics();
                                            g.drawString(state.string, state.x, state.y+metrics.getAscent());
                            if (lagState.intersects(clip)) {
                            g.setColor(Color.red);
                            if (!lagState.font.equals(g.getFont())) {
                                g.setFont(lagState.font);
                                metrics = g.getFontMetrics();
                            g.drawString("Lag", lagState.x, lagState.y+metrics.getAscent());
    }Here is the code that iterates through the letters to see if a letter contains the mouse location:
                if(e.getSource()==canvas&&edit) {
                    for(Letter l : letters) {
                        Rectangle rec = new Rectangle(l.x+l.xoffset,l.y+l.yoffset,l.width,l.height);
                        if(rec.contains(new Point(e.getX(),e.getY()))&&l.resizing==false&&l.defaultSize==l.font.getSize()) {
                            l.resizing = true;
                            new Thread(new ExpandLetter(l)).start();
                        else if(!rec.contains(new Point(e.getX(),e.getY()))&&l.resizing==false){
                            l.font = new Font(l.font.getName(),l.font.getStyle(),l.defaultSize);
                            l.resizeLetter(l.text);
                }However I just learned that this loop itself is taking up a huge amount of memory by saying
    l.font = new Font(l.font.getName(),l.font.getStyle(),l.defaultSize); When I take that line out the lag is reduced by a lot. Also I think that it isn't forgetting the "old" letters font that it is replacing by saying new Font() and after running this loop once my program runs slow and laggy as if it doesn't have enough memory to run fast anymore. Is there something I am doing wrong by initiating a new Font. I would have thought that it wouldn't take up anymore memory because it replaces the old font the the letter "l" has. The loop seems to have some kind of memory leak if someone could point it out to me that would be great. Thanks :)
    Edited by: neptune692 on Feb 16, 2010 8:18 PM

    neptune692 wrote:
    can I attach some kind of mouse listener to each letterTry this:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.util.*;
    import javax.swing.event.*;
    public class SimplePaintSurface implements Runnable, ActionListener {
        private static final int WIDTH = 1250;
        private static final int HEIGHT = 800;
        private Random random = new Random();
        private JFrame frame = new JFrame("SimplePaintSurface");
        private JPanel tableaux;
        public void run() {
            tableaux = new JPanel(null);
            for (int i = 15000; --i >= 0;) {
                addRandom();
            frame.add(tableaux, BorderLayout.CENTER);
            JButton add = new JButton("Add");
            add.addActionListener(this);
            frame.add(add, BorderLayout.SOUTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(WIDTH, HEIGHT);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            tableaux.requestFocusInWindow();
        public void actionPerformed(final ActionEvent e) {
            addRandom();
            tableaux.repaint();
        void addRandom() {
            Letter letter = new Letter(Character.toString((char) ('a' + random.nextInt(26))));
            letter.setBounds(random.nextInt(WIDTH), random.nextInt(HEIGHT), 16, 16);
            tableaux.add(letter);
        public static void main(final String[] args) {
            SwingUtilities.invokeLater(new SimplePaintSurface());
    class Letter extends JLabel {
        Font font1;
        Font font2;
        private final FontRenderContext fontRenderContext1;
        private final FontRenderContext fontRenderContext2;
        public Letter(final String letter) {
            super(letter);
            setFocusable(true);
            setBackground(Color.RED);
            font1 = getFont();
            font2 = font1.deriveFont(48f);
            fontRenderContext1 = getFontMetrics(font1).getFontRenderContext();
            fontRenderContext2 = getFontMetrics(font2).getFontRenderContext();
            MouseInputAdapter mouseHandler = new MouseInputAdapter() {
                @Override
                public void mouseEntered(final MouseEvent e) {
                    Letter.this.setOpaque(true);
                    setFont(font2);
                    Rectangle bounds = getBounds();
                    Rectangle2D stringBounds = font2.getStringBounds(getText(), fontRenderContext2);
                    bounds.width = (int) stringBounds.getWidth();
                    bounds.height = (int) stringBounds.getHeight();
                    setBounds(bounds);
                @Override
                public void mouseExited(final MouseEvent e) {
                    Letter.this.setOpaque(false);
                    setFont(font1);
                    Rectangle bounds = getBounds();
                    Rectangle2D stringBounds = font1.getStringBounds(getText(), fontRenderContext1);
                    bounds.width = (int) stringBounds.getWidth();
                    bounds.height = (int) stringBounds.getHeight();
                    setBounds(bounds);
            addMouseListener(mouseHandler);
    }

  • Concurrent modification exception while iterating through list

    Hi,
    I have a list of objects. I use for each loop in java to iterate through that list of objects and display them.
    The problem is that while iterating other thread can add or remove some objects from that list, and I get ConcurrentModificationException.
    How can I handle this problem. How can I be sure that I am iteration through the updated list.
    Thank you

    Synchonize on the list before iterating through it, and make sure that other code also synchronizes on the list before adding to it or removing from it. Using a list implementation that simply synchronizes all the methods (e.g. Vector) will not do that, you have to do it yourself.

  • Iterating through View Object RowIterator Bug.

    I use this code to loop through the rows of a view object (As described in javadoc of RowIteratior).
    public String checkIterations() {
    String res = "Iterated through : ";
    RowIterator view = this.getDepartmentsView1();
    view.reset();
    Row row;
    while ((row = view.next()) != null) {
    System.out.println("rownum: " + row.getAttribute("RowNum"));
    res += row.getAttribute("RowNum") + " ";
    return res;
    Yet this code never goes through the first row if the executequery has been performed for view object.
    details:
    [http://adfbugs.blogspot.com/2009/07/iterating-through-view-object.html]
    Is this a bug?
    Edited by: mkonio on Jul 28, 2009 11:41 PM

    Thanks Andrejus and Steve.
    Its a development bug
    problem and solution described in:
    Fusion Developer's Guide for Oracle ADF
    9.7.6 What You May Need to Know About Programmatic Row Set Iteration

  • Iterating through a generic list of unknown type

    Hi,
    I am in the process of creating pdf reports for my project.I have to deal with a persistence api to get the data for the report.The data will be in the form of a list,like List<SomeObject>,all these lists returned by the persistence framework contains object of some type which implements a common interface.But through that interface I wont be able to get all the data for my reports.So I am looking for a generic way for iterating through the list,by providing some metadata for the data within the list. I am planning to use reflection to query through the list.Is there any feature of generic,through which I can easily iterate through this unknown type,preferrably a combination of reflection and generics,I want to reduce the LOC.Any suggestions??

    If the List returned by the framework isn't parameterized, Like
    public List<K> getList(Class<K> classType);
    then you have to cast it to the appropriate type. If you are not sure about the type of the Objects in the list, and you have a bunch of class types you could expect from the list, then you could use instanceof operator.
    If it could be Class A or B, then
    if (obj instanceof A){
    A castObject = (A) obj;
    else if(obj instanceof B){
    B castObject = (B)obj;
    }Even to do reflection to invoke methods, you need to know the method Names. Which tells me you have the knowledge of what could come out of the list. So cast them. Invoking methods using reflection is really slow.

  • Looping through records

    New to PL/SQL and wondered if you can simply loop through records in order to ouptut as single string in a file?
    DECLARE
    v_string_rec VARCHAR(4000);
    type v_cols is record;
    BEGIN
    FOR rec IN (SELECT * FROM PLAY_OWNER.STG_CUSTOMER)
    -- somehow need to get the single record into record var then loop through that?
    LOOP
    FOR i IN v_cols.FIRST .. v_cols.LAST
    LOOP
    v_string_rec := recs(i) || v_string_rec;
    END LOOP;
    DBMS_OUPTPUT.PUT_LINE (v_string_rec);
    -- UTL_FILE operations, insert rows
    END LOOP;
    END;
    Give me a slap by all means, as I say kind of new to this

    Just as a curiosity, using some xml capabilities we can obtain a strig concatenation of all columns of a given query this way:
    SQL> with t as
      2  (select xmltype(dbms_xmlgen.getxml(DBMS_XMLGEN.newContext('SELECT * FROM emp'))) doc
      3     from dual)
      4  select extract(column_value,'//text()') myrow
      5  from t, table(xmlsequence(extract(t.doc,'/ROWSET/ROW')));
    MYROW
    7369SMITHCLERK790217-12-198080020
    7499ALLENSALESMAN769820-02-1981160030030
    7521WARDSALESMAN769822-02-1981125050030
    7566JONESMANAGER783902-04-1981297520
    7654MARTINSALESMAN769828-09-19811250140030
    7698BLAKEMANAGER783901-05-1981285030
    7782CLARKMANAGER783909-06-1981245010
    7788SCOTTANALYST756619-04-1987300020
    7839KINGPRESIDENT17-11-1981500010
    7844TURNERSALESMAN769808-09-19811500030
    7876ADAMSCLERK778823-05-1987110020
    7900JAMESCLERK769803-12-198195030
    7902FORDANALYST756603-12-1981300020
    7934MILLERCLERK778223-01-1982130010
    14 rows selected.And all the single attribute values this way:
    SQL> with t as
      2  (select xmltype(dbms_xmlgen.getxml(DBMS_XMLGEN.newContext('SELECT * FROM emp'))) doc
      3     from dual)
      4  select extract(column_value,'//text()') attribute_value
      5  from (select column_value myrow
      6          from t, table(xmlsequence(extract(t.doc,'/ROWSET/ROW')))
      7        ) r, table(xmlsequence(extract(r.myrow,'/ROW/*')));
    ATTRIBUTE_VALUE
    7369
    SMITH
    CLERK
    7902
    17-12-1980
    800
    20
    7499
    ALLEN
    SALESMAN
    7698
    20-02-1981
    1600
    300
    30
    7521
    WARD
    SALESMAN
    7698
    22-02-1981
    1250
    500
    30
    7566
    JONES
    MANAGER
    7839
    02-04-1981
    2975
    20
    7654
    MARTIN
    SALESMAN
    7698
    28-09-1981
    1250
    1400
    30
    7698
    BLAKE
    MANAGER
    7839
    01-05-1981
    2850
    30
    7782
    CLARK
    MANAGER
    7839
    09-06-1981
    2450
    10
    7788
    SCOTT
    ANALYST
    7566
    19-04-1987
    3000
    20
    7839
    KING
    PRESIDENT
    17-11-1981
    5000
    10
    7844
    TURNER
    SALESMAN
    7698
    08-09-1981
    1500
    0
    30
    7876
    ADAMS
    CLERK
    7788
    23-05-1987
    1100
    20
    7900
    JAMES
    CLERK
    7698
    03-12-1981
    950
    30
    7902
    FORD
    ANALYST
    7566
    03-12-1981
    3000
    20
    7934
    MILLER
    CLERK
    7782
    23-01-1982
    1300
    10
    101 rows selected.Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/]

  • Iterating through entrys of HashMap

    I have a HashMap that is already populated. I'm iterating through the entrySet and want to get the keys and values and use them to create another object. I've searched the forum and googled but can't quite seem to find what I need. Here's the code I have so far.
    Iterator iterator = map.entrySet().iterator();
    while (iterator.hasNext()) {
    if (iterator.next() != null) {
         reasonsList.add(new DropDownData(key, value)); // here's where I'm not sure what to do
    }The DropDownData object accepts twos strings, one for the key and one for the displayed value. These strings should be the key and value from my current HashMap entry. But I can't seem to figure out how to do it.
    thanks for any help/suggestions

    iterating over the not-null entries or iteratingover
    gotten entries that are not null is equivalent,maps
    return "null" for unexisting keys...
    I do not understand what you are saying here.
    It is not required that Map implementations return "null" for non-existent keys.
    It just happens to be the way the implementations in the JDK are implemented.
    The documentation specifically says that Map.get(key) could be allowed to throw a NullPointerException.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html#get(java.lang.Object )
    >
    I would add that map's structure suggests it's the
    way to go (I mean, mine of course ;))
    That's a matter of interpretation.
    what's the point in iterating over the values when
    you need the key ?When you need the keys and the values (as in the case of the OP), then there is plenty of point in it.
    >
    the only way (the API should define) to iterate over
    a map is through the key (hence the "map" name),
    entrySet is (as far as a I reckon) a twisted bypass...It's in the API. It works well. It's useful. So there's no reason not to use it when it is applicable.

  • Inserting records in a table after iterating through it

    Hi,
    I have a table like this:
    Col 1 Col 2
    1 rat
    2 hen
    1 dog
    1 cat
    3 lion
    My requirement is to process all the records with unique values in col 1, means I will be inserting these unique records in table A and if the record repeats like for values in Col 1, we have duplicates 1,1,1. these duplicate values will be inserted in table B. Only one value will go in table A out of all the duplicates and other two duplicate values will get inserted in table B.
    All this needs to be done using a SQL query. I can't use procedure, function or any other database object. I should use only SQL query.
    Could anyone help me in designing this?
    PS: Am a java developer with basic knowledge of PL/SQL.
    Thanks.

    Centinul wrote:
    Hope this helps!Based on "other two duplicate values will get inserted in table B" it should be:
    INSERT ALL
         WHEN rn = 1 THEN
              INTO a (col1, col2) VALUES (col1, col2)
         WHEN rn != 1  THEN
              INTO b (col1, col2) VALUES (col1, col2)
    SELECT col1
         , col2
         , ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2) AS rn
    FROM   table_x
    ;SY.

  • Trying to loop through records

    Hi
    I trying to loop through my records and write to a database each time, but my code only seems to write the first time through...
              //check for the stock levels...
              Iterator stockLevels = getItems().iterator();
              pstmt = dbConn.prepareStatement(sql_bundle.getString("findStock"));
              while (stockLevels.hasNext()) { 
                   CartItem stockL = (CartItem) stockLevels.next();
                   pstmt.setString(1, stockL.getProduct().getISBN());
                   ResultSet rscp = pstmt.executeQuery();
                   if(rscp.next()){
                        if (rscp.getInt("STOCK_LEVEL") > stockL.getQuantity()) {
                             int newAmount = rscp.getInt("STOCK_LEVEL") - stockL.getQuantity();
                             PreparedStatement pstmte = dbConn.prepareStatement(sql_bundle.getString("updateStock"));  
                             pstmte.setInt(1, newAmount);
                             pstmte.setString(2, stockL.getProduct().getISBN());
                             pstmte.executeUpdate();
                        } else {
                             cat.error("Right Bloddy mess");
                                 throw new Exception();
                   }else{ 
                        throw new Exception("No results from known good query.");
              pstmt.close();I get the following error in my browser:
    org.apache.jasper.JasperException
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
    and no errors when I compile using javac...
    Thanks

    excellent my looping is working...
    thanks

  • Iterating through master view objects and child view objects in same page

    I am working on a project using ADF UIX and Business Components.
    I have an application module with two view objects one the master view object and the second the detail object. They are related via a view link.
    I would like to iterate through the master view objects displaying a customer name as bold text and then below each customer name I'd like to display the detail records in a table via the detail view object i.e. a seprate table for each customer.
    Is this possible - I haven't had much luck!?
    Thanks in advance.

    That's because
    $(".ms-vb2 a").
    is bringing back all the pieces that have that class with an anchor on the whole page, not just the ones in the .ms-wpContentDivSpace
    I don't know the exact syntax, but I think you need to iterate through all the '.ms_vb2 a' items as well - there are multiple ones, and do something like this inside your other grouping
    $(".ms-vb2 a").each(function(index) {
        var val=$(this).html();
       var val2=val.replace(/_/g," ")
       $(this).html(val2);
    That's not quite right but maybe that will help.
    Robin

Maybe you are looking for

  • HP Officejet Pro 8600 Plus (All-in-One) - Incoming Fax but mistakenly answer phone

    I have landline phone service.  On this line, I have multiple phones, an answering machine, internet service via wireless Uverse setup, and the HP Officejet Pro 8600 Plus as a fax.  It's also a printer/scanner - but that uses the wireless Uverse serv

  • HELP! I can't add any clips to the storyline.

    It used to work fine, dragging clips to the storyline or using Insert or Append. Now I can't add any clips to the storyline, dragging doesn't seem to drag any clips, Append and Insert don't react. I create a new project, and I see the storyline, but

  • AP not joining

    Hi all, I could need a little help troubleshooting some AP issue. For some reason some AP will not join the WLC. (WISMII) I have several hundrede AP online, but still a few offline This fails: FRH-R06-L226-UX-G#sh cdp nei gi2/0/41 detail Device ID: A

  • Planner group field in Maintenance order

    Hi, When we create a General Maintenance Order, the planner group from Equipment/Functional Location, value, will automatically appear in the Order. But in Refurbishment Order, which is for material, the planner group field do not come automatically.

  • IPod Update Error: The network connection has timed out.

    I have an iPod Touch second gen and am trying to update it from software version 2.1.1 to 2.2.1. Every time I try to "Download and Install" the new update, it downloads all the way but then an error pops up(picture below). This error also occurs if I