Scrolling Resultset example?

this is a posting from another thread that I was looking for clarification on. I understand what's being said but I don't quite understand how to reference the resultSet from this explanation:
USE a Scrollable ResultSet object and put it in the session. Keep a variable that identifies where in the resultset ur pointer is at any point of time.
Scrollable ResultSets are a feature only available with JDBC 2.0 onwards... so make sure u have THAT first.
Create a Statement like this...
Statement st =
con.createStatement(ResultSet.SCROLLABLE);
Then run the query n store it in the resultset
ResultSet rs = st.executeQuery(sql);
Then move ur pointer to any record u want with methods present in the ResultSet interface:
relative(int rows) that takes you 'rows' rows ahead.
absolute(int row) that takes your pointer to the 'row'th ROW.
Make sure u use 'refreshRow()' so u have the latest content at any point of time. This refreshes the contents in that row. there is also something called refresh() BUT THAT would minimise performace.
Store this resultset object in the session and call it in each page u want starting with the record number u want to. !!
Hope this helps... aXe!
My question is, does someone have a simple example page that does what is described above? Also, to get the number of pages that will be involved, would you first "SELECT * FROM table" and count the rows, divide by the number of rows to display per page, and then create a URL for each number to jump to the next grouping of rows doing something like this?:
(suppose you want 10 rows per page)
2
4
the code would simple do:
<% String page = request.getParameter("page");
rs.absolute(page);
while (rs.next()){ %>
<% ...print out row contents here... %>
<%}%>
Does this sound correct...where does the "refreshRow()" need to go to clear the row? Also, would you need to use LIMIT (to 10 rows)in the SELECT statement?
Any help in understanding this is greatly appreciated!
Chuk.

well, with some tweaking I had figured it out but ran into another problem:
I need to know in advance how many pages will be required to display the entire ResultsSet to print 1,2,3,4, etc as hyperlinks and link them to the jsp to scroll back and forth. So I tried to do the following
(suppose the ResultSet hold 12 records total which I would get like this):
//get total number of rows, this is a very round about way but I'm new to this
int totalRows = 0;
rs.last();
totalRows = rs.getRow();
rs.first();
rs.previous();
//set the number of rows to display per page
int pageRows = 10;
//initialize variable to hold the number of pages needed
int pages = 0;
//So then I would calculate the number of pages:
pages = totalRows/pageRows;
//then print the page numbers
for (int i = 0; i <= pages){
out.println("<a href sample.jsp?page="+i+"> "+i);
This would work great if only the integer was always rounded up. In this example, I want 10 rows per page displayed and there are 12 total. In this calculation I would want the variable "pages" to equal 2 b/c you would have one page of 10 rows and then the second page of 2 rows. The type integer is always rounded down it seems so I end of with a value of "1" in the integer "pages"
There must be a better way to do this...anyone have any ideas or have you done this before?
thanks in advance,
Chuck

Similar Messages

  • JDBC 2.0 Scroll-ResultSet is not working

    MY Environment is
    OS = W/NT
    Servlet Engine = JRUN 1.8
    JDK = JDK1.2.2
    Language = JSP (Jsdk2.0)
    JDBC Driver = Oracle JDBC THIN Drivers
    release 8.1.6 for JDK 1.2.x (classes12.zip)
    DBMS = Oracle 8.1.5
    A statement using a constructor like below produces no result, the HTML-output stops at the point where the statement is created, but there is no error or exception message.
    Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    Using the "createStatement()"-constructor is working all right, but specifiying resultset and concurrency type (even if TYPE_FORWARD_ONLY and CONCUR_READ) produces the reaction described above.
    Any suggestions welcome, please send mail to:
    [email protected]
    null

    Meanwhile I have succeeded in running a scrollable result set with Oracle's driver by simply changing the jsp-environment and using Tomcat (http://jakarta.apache.org/). Everything seems to be working all right now. So after all, JDBC 2.0 Scroll-ResultsSet is working.
    null

  • Background image not scrolling with text

    My foreground text will resize with my browser but the background stays stationery, remains in the upper left. How do I fix this? I have included part of my code.
    Ideally I would like to anchor text boxes to background image so it will scroll all together. If this can't be done I can use the margins and padding to adjust my text to work with the background I just need it to move with it.  I've seen samples of this, which i  think may have been done in photoshop but I would like to keep the copy live in DW. FYI, I added "background-attachment:scroll" to the code. I have searched and searched online for a solution to no avail.  I am attaching a coupld of PDFs so you can see where I want to go. Any help is greatly appreciated. Thanks a bunch in advance and please be gentle.
    body  {
         background: #666666; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
         padding: 0;
         text-align: center;
         background-image: url(Images/Background_Radial77.jpg);
         background-repeat: no-repeat;
         margin-right: 0%;
         margin-top: 19%;
         color: #FFF;
         background-color: #FFF;
         background-attachment:scroll
         margin-left: 0%;
         font-family: Verdana, Arial, Helvetica, sans-serif;
         font-size: 100%;
         margin-bottom: 0;
         margin-left: 0;

    My foreground text will resize with my browser but the background stays stationery, remains in the upper left. How do I fix this?
    That's how web pages work.  Remember, web design is nothing like print design.  Printed pages or graphics are static.   Web pages must be flexible to accommodate  different displays, text sizes and varying amounts of content.   Trying to precisely position text or other objects over a huge background is a bit like  trying to nail Jello to a wall.  No matter how hard you try,  it will never hold up.
    Fixed Background Example -
    http://alt-web.com/DEMOS/fixed-background.shtml
    Scrolling Divisions Example -
    http://alt-web.com/DEMOS/multi-scrollbars.shtml
    Your best option is to slice and dice your background image into usable segements in Photoshop or Fireworks.  Save images only.  Then re-assemble slices  in  DW to create flexible containers.
    Basic Tutorial - Bringing 3 image slices into a CSS layout -
    http://alt-web.com/DEMOS/Image-slices-in-a-CSS-based-layout.shtml
    Advanced Tutorial -
    Taking  a Fireworks (or Photoshop) comp to a CSS based layout in DW
    http://www.adobe.com/devnet/fireworks/articles/web_standards_layouts_pt1.html
    Good luck with your project,
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Weight of a page /reveal images when scrolling.

    Hello, all!
    This is my first post in the DW forum, my field of expertise is Photoshop and imaging in general.
    A user in the french forum asked several questions that I can't unfortunately answer:
    ( http://forums.adobe.com/message/4728148#4728148 )
    One deals about the total weight of a page, when images are only revealed with a mouseover. I originally pointed the weight/time meter on the bottom of the document panel, but the question is about the total weight with the linked images. (But the actual amount loaded when one reaches the page initially is the one listed, right?)
    The second question deals about the fact that she noticed on certain sites that images are revealed/load only when one scrolls down to reach their location in the page. My assumption is that it is done with a script, but I might be totally wrong.
    Hoping you can help me help him/her.

    For the images that load only when the area is in focus (scroll, for example) she can use Lazyload plug-in. You can get details here: http://www.appelsiini.net/projects/lazyload
    For the load shown in status bar of DW, it's 'File Size/ Download Time'. This excludes all 'remote' images. As the name suggests, it only displays the actual 'file' size and objects that have been written into the file and locally linked.

  • Report header scroll

    Hi everyone,
    I have built a SQL report with a template that i have built (no apex template) and in the SQL Query, I wrote follows:
    htp.p('<table>');
    htp.p('<thead>');
    htp.p('<tr>');
    htp.p(v_headings);
    htp.p('</tr>');
    htp.p('</thead>');
    htp.p('<tbody>');
    for r in loop
    htp.p(v_data);
    htp.p('</tr>');
    end loop;
    htp.p('</tbody>');
    htp.p('</table>');
    so, tis works fine.
    but the Problem is, there are much data to be displayed, and I want to fix the header and scroll the data in the Body like in Excel.
    but no Idee how to do that.
    I follows some forum threads but didnt help me really.
    any Idee?
    many thanks in Advance.
    Edited by: user10773430 on Oct 19, 2009 4:20 PM
    Edited by: user10773430 on Oct 19, 2009 4:28 PM

    Hi User?????,
    Can you please update your user id?
    Hope that following links will help you:
    # By Roel Hartman: jQuery - Fixed Header
    # By Andy Tully: Re: Horizontal scrolling report
    example link: http://apex.oracle.com/pls/otn/f?p=267:89
    Thanks,
    Bhavin

  • Unstable ResultSet

    We have a core Java batch application. It uses JDK 1.3 with an Oracle 9i database through Oracle Thin Driver. No app server is used.
    In this Java program, we have a ResultSet mapped to a database query returning 40,000 rows, each row having 380 fields. Then we loop through the ResultSet and do some processing in each loop. What we find is that the program aborts at random intervals (say at the 25,000th loop) with a Null Pointer Exception. When it aborts, it is found to be at the end of a loop (i.e. about to start the next loop).
    And also, even though the database commit is issued only once every 5 loops, the failure is seen to happen immediately after a commit (but, of course, failure does not occur after every commit, but after many loops).
    We think that the failure is occurring at the time of a new fetch. If the default fetch size is 10, this also explains why we see a failure only after a commit (our commit frequency is 5).
    Any pointers on why this could be happening and what we can do to fix it?

    i work for several years now with Oracle JDBC drivers and never had such problems (JDK 1.2, 1.3, 1.4). probably you have a forward only resultset. if you want to "loop" several times through the same resultset you need a scrolling resultset. see api docs of java.sql.ResultSet and java.sql.Connection.createStatement()

  • Non-scrolling result sets

    In kodo 3 "Kodo now uses non-scrolling result sets by default, and fetches
    all query results up-front by default. See the large result set section of
    the reference guide for how to configure large result set handling if
    needed"
    How does 2.5.3 work? Is there any way to use non-scrolling result sets in
    it? I always use fetch all mode and scrolling result set would be a big
    overhead for me

    Alex-
    If you have "com.solarmetric.kodo.DefaultFetchThreshold" set to -1, then
    Kodo will always use non-scrolling ResultSets (as well as instantiating
    all the results up front).
    http://docs.solarmetric.com/manual.html#com.solarmetric.kodo.DefaultFetchThreshold
    In article <bks8r7$7op$[email protected]>, Alex Roytman wrote:
    In kodo 3 "Kodo now uses non-scrolling result sets by default, and fetches
    all query results up-front by default. See the large result set section of
    the reference guide for how to configure large result set handling if
    needed"
    How does 2.5.3 work? Is there any way to use non-scrolling result sets in
    it? I always use fetch all mode and scrolling result set would be a big
    overhead for me
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Any way to scroll the viewport of a cropped LDM?

    I’m modifying Openspark’s vertical scroll bar
    example (
    http://nonlinear.openspark.com/tips/oop/scrollBar/index.htm)
    to allow both vertical and horizontal scroll bars on the same LDM.
    Essentially these scripts cycle through every sprite in the LDM and
    move them a given increment. It works well enough but I’m
    banging my head against the wall thinking there must be a way to
    modify the viewport of an LDM in similar fashion to scrolling an
    MIAW with drawRect. Does anyone know some tricks or is moving every
    sprite individually really the best way?

    On ma, 2008-01-14 at 19:41 +0000, Applied CD wrote:
    > I?m modifying Spenspark?s vertical scroll bar example
    > (
    http://nonlinear.openspark.com/tips/oop/scrollBar/index.htm)
    to
    > allow both
    > vertical and horizontal scroll bars on the same LDM.
    Essentially
    > these scripts
    > cycle through every sprite in the LDM and move them a
    given
    > increment. It works
    > well enough but I?m banging my head against the wall
    thinking there
    > must be a
    > way to modify the viewport of an LDM in similar fashion
    to scrolling
    > an MIAW
    > with drawRect. Does anyone know some tricks or is moving
    every
    > sprite
    > individually really the best way?
    >
    Hi again,
    I dont have another solution for this.
    I have done some experimenting, but can not find a way to
    "change the
    viewport" either.
    I was hoping something like "tell sprite() to set the rect of
    the
    stage
    to rect()" would work, but it sets the rect of the
    main-stage, not the
    rect of the LDM-stage. I think this is one of the
    shortcomings of
    LDM's.
    Years ago there was an aticle on one of the Director lingo
    sites about
    linked Director movies, and the tricks you can play with
    them.
    But... you guessed it, I can not remember.
    It was something with clocks... maybe google can help?
    I even tried to use the Shockwave ActiveX, hoping it would
    play the
    extenal movie with scrollbars. But the only thing I get is an
    immediate
    Director crash. :(
    The moving of the sprites is not that bad.
    You can make 1 generic behaviour for all the sprites, that
    moves the
    sprite with an extra offset.
    Something like:
    property myStartLoc
    global gOffset
    on beginSprite me
    myStartLoc = the loc of sprite(me.spriteNum)
    end
    on prepareFrame me
    set the loc of sprite(me.spriteNum) to myStartLoc + gOffset
    end
    You can now change the value of gOffset right in the main
    movie, to
    move
    all the sprites with this behaviour.
    gOffset should be a rect.
    Good luck,
    let me know how it goes.
    Richard.

  • Smooth list scroll (scrollpane?)

    Hi,
    Im having a go at developing an Air-app for Android and I will render a long scrollable list.
    Is there a way to get a smooth scroll for example like when scrolling a  webpage in Android?
    Right now Im using a scrollPane and it is extreamly un-smooth. Not very nice when using a touchscreen.

    Hi Gibbah
    You should also have a look at this as it should help as well.
    http://custardbelly.com/blog/?cat=27
    https://github.com/bustardcelly/as3flobile-android
    regards Mike

  • Scrolling in Apps

    Hello community,
    at SL I can scroll for example in iTunes by 2 Fingers left or right for going back or forward.
    In Lion it seems that this possibility exist only in safari? So you have to use the key back and forward instead?
    Thanks

    The two you might have seen are http://plentycom.jp/en/steermouse/ and
    http://www.usboverdrive.com/
    Neither say they have application specific restrictions that I can find on their website at first glance. If you find that they do, please let us know.

  • Scrolling only part of a page...possible?

    I'd like to have a page where the left side contains a few components that stay put no (do not scroll) as well as an area in the top center of the page, but have the right side hold components that allow vertical scrolling
    For example, let the # symbol denote data that does not scroll and the % symbol denote data that can. The page would then be represented with something that looks like this:
    #######    %%% <--scroll bar here
    #######    %%% <--scroll bar here
    #######    %%% <--scroll bar here
    #######    %%% <-- scroll bar hereHow might this be done? Would you have to use frames or can something like a page fragment do the job? If this were Swing, you could just drop the components that you need to scroll inside of another component, but I don't see any components on the pallet that would support something like this other than maybe a page fragment.
    Thanks!

    Hi,
    This is rather easy to be honest, although I can't tell you by heart how to accomplish this. What you want to do is separate your pages in areas demarked by <div></div> tags that have an ID that more or less tells you what part of the page you're talking about.
    Please note that the ID is just for your reference so you know what you're talking about, but an ID is requried, more or less.
    Anyway enough about ID's, use the position value of your stylesheet selector to create your page. By setting it to fixed, or absolute or static, you can actually create exactly what you want.
    Okay, that was a lot of useless information, but it is possible, you now know this. It would be better to check out the website of Wester Civilization (http://www.westciv.com/style_master/academy/hands_on_tutorial/index.html)
    They've got an excellent CSS editor (I'm not affiliated with them, but I happen to use their tool (Style Master 4.02) which helped me to create my web-pages by just using CSS and that works great in conjunction with Creator/JSF. There's a tutorial on their site that you can do to create exactly the page as you described and the tutorial is a CSS tutorial that helps you in using the tool, but explains everything in a way that you can use any editor.
    Hope this helps.
    Iwan

  • Scroll area possible?

    Hi, I'm very new to Catalyst (actually, I haven't created anything yet) and am thinking this might be the perfect medium for creating a simple app simulation I've been tasked with building.
    This app will be on the iphone, so I've created a PSD containing all the necessary elements. I'd like to be able to scroll across a couple of screens like you can do on the iphone where you swipe your finger across the button screen, and the rows of buttons move along with your finger. Offhand, I don't know if I can do this within Catalyst. I've looked at the scroll panel component, and have viewed a scroll panel example posted here. The issue is that I don't want to have a scroll bar, I would like the whole button panel to be scrollable via click and drag. Is that possible?
    Thanks!
    Graham

    OK, this thread pretty much wrapped it up for me: http://forums.adobe.com/thread/514154?tstart=0
    In a word, I'm barkin' up the wrong tree (euphymism for "this is an unsupported function"). I'll put it in feature requests.
    Thanks!
    Graham

  • PersistenceManager Cache

    I just want to know how the persistence manager maintains cache.
    1.When i get the instance of persistence manager,during that time itself,all
    the JDO instances will be loaded in cache??
    or lazy loading???Like only when a request to get an extent of a JDO
    comes,then only the instances will be loaded in cache??
    2.How about Query Results??All the results will be loaded and returned or
    Lazy loading as you traverse thru the result list??
    Srini

    See inline:
    Srini wrote:
    I just want to know how the persistence manager maintains cache.
    1.When i get the instance of persistence manager,during that time itself,all
    the JDO instances will be loaded in cache??No. The PersistenceManager's cache is a lazy one. It maintains a
    growing blob of data.
    or lazy loading???Like only when a request to get an extent of a JDO
    comes,then only the instances will be loaded in cache??Yes. However, extents can be lazily loaded depending on if your
    database supports scrolling resultsets.
    2.How about Query Results??All the results will be loaded and returned or
    Lazy loading as you traverse thru the result list??Same as an extent.
    >
    SriniNow here are some things to note:
    You can always boot an object from the PersistenceManager's cache...
    for example:
         Extent e = pm.getExtent (Foo.class, true);
         for (Iterator i = e.iterator (); i.hasNext ();)
              pm.evict (i.next ());
         e.closeAll ();
    Should have a small size cache (depending on state before this code block).
    Also, we have PersistenceManagerFactory caching which is another layer
    below, for those who have bought the feature (which is included in our
    enterprise package) which stores objects in a more durable manner.
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • Full Screen Mode Help

    Ok, i want to be clear about what i want here because i have seen alot of similar topics but i dont know if people understand what im looking to do. So lets say i create a stage of 5000 pixels by 5000 pixels. When i export to html (even with 100 percent x 100 percent) what i get is a compressed version in whicn i can grab my window and expand and contract the window while still holding the entire stage in my browser window. In other words even though in flash the plane of the stage is greater than the plane of the browser, the browswer still contains the entire stage no matter what size my browser window is. What would i like to do? Well if you look at the converse shoes website for example (as its flash) you can see that the plane is greater than the browser window so if you contract the browser window the browser automatically adapts by allowing scrolling motions, where as if you expand the window to be larger than the plane of the stage it fits it in nicely. This is what i want, so i don't expand and contract the entire flash stage but have the flash stage sized independantly of what my HTML browser window exists in.
    example of what i want
    http://www.converse.com
    notice how you can expand and contract and the plane of the site still exists and the window brings up scrolling panels
    example of what i do NOT want but have for some reason
    http://www.petersage.com/meetpeter/
    notice how if you expand or contract browser window the whole flash stage gets compressed or stretched.

    thank you for replying ned. Unforunately 2 things. 1, making the pixel values the same instead of 100 percent is the exact same thing as making them 100% of their values. 2ndly, i did go ahead and try it and same thing happens, i get see my website (if you could call it that at this point) taking up the full screen, however when i expand the site it makes white bars on the side of the screen and when i contract it, it compresses the entire image shrinking it to the window size. Go ahead and try shrinking both browser window sizes in the example flash sites i posted and the converse one is what i want to happen, the other one is what is happening with my site.

  • Using the click wheel quickly pulls up a letter...but the WRONG LETTER

    OK, this is funny and somewhat topical. I am afraid it is a predecessor to future problems though.
    When using the click wheel rapidly in song selection we all know that letter pop up to help you scroll quicker. Well, the series of letters for me goes something like this:
    A B T B C D E T E F G H T H I J K L T L...you get the idea. Yes, it repeats the letter "T" over and over.
    Does anyone have any ideas about this? I have reset the iPod, but am leary about restoring it because I have 45 episodes of The Office and 6700 songs to mess with.
      Windows XP Pro  

    I am going to post, no so much an answer, but an observation. Here is what I noticed. The letter 'T' pulls up whenever there is the word "the" in the title. So, I am thinking that with the new iTunes, it updates the iPod not to recognize the word "the" when alphabetizing, but it recognizes the letter 'T' when scrolling.
    Example: Bananarama - Venus would come first, then the next song is The Band - Acadian Driftwood. So, Band comes after Bananarama if you omit the word "the", but the letters recognize the 'T' in the. Make Sense?
    Anyone have any thoughts on this? Does anyone know where I can tell Apple about it?
    Apple needs a section that we can click on called "stupid things we seem to overlook" and then fill out opinions on dumb screwed up options like this.

Maybe you are looking for

  • How can I embed a Keynote presentation on a web page?

    I created a Keynote presentation using Keynote version 6.5 (OS X Yosemite). I found the "export as html" option, which creates an entire web page named index.html. I opened that web page in Dreamweaver, but I'm not talented enough to figure out how t

  • How to display data in Table control?

    Hi Experts, Can anyone please explain me how to display the data from two different tables(those two table is related with 1 field) into a single table control? For Example: T1 has fields (F1,F2) and                      T2 has fields (F3,F4) --> her

  • How do i install lexmark X1250 on a imac

    how do i install lexmark X1250 on a imac

  • Widescreen Videos On New Apple tv

    Why are only some videos i.e music videos playing in widescreen? The majority are in standard! I want them all in widescreen! Any advice? Thanks

  • Help for basic VOIP function on 2821

    Hi, I'm new to VOIP. Sorry for this simple question. We have two Cisco 2821 routers, two 7960G IP phones. Each 2821 router has PVDM2-8 DSP module, HWIC-4ESW 4 port swtiching card, IOS 12.4(22)T3. No any Call Manager software is loaded. Can anyone poi