Display resultset in pattern

Hello,
I have data stored in the database like this in two columns FROM_URL and TO_URL
FROM_URL ---- TO_URL
start ---- a.html
a.html ---- b.html
b.html ---- c.html
start ---- k.html
k.html ---- h.html
h.html ---- f.html
f.html ---- t.html
start ---- k.html
k.html ---- l.html
So I want to display it like
1) start -> a.html -> b.html -> c.html
2) start -> k.html -> h.html -> h.html -> f.html -> t.html
3) start -> k.html -> l.html
I have got an idea here. But this code executes the query only once. If I can write a condition which can loop the output in such a way that if
FROM_URL="START"
it starts a new count.
here is my code.
try {
Statement stmt = conn.createStatement( );
String query = "select FROM_URl, TO_URL from LOG ORDER BY TIME ASC";
ResultSet rset = stmt.executeQuery( query );
rset.next( );
System.out.print ( "<ol><li>" );
System.out.print ( "Start" );
while(rset.getString(1) == "START")
do{
//System.out.print ( "START");
System.out.print ( " &rarr; " + rset.getString( 2 ) + "<br>");
}while(rset.getString(1) != "START");
System.out.print ( "</li></ol>" );
System.out.println( );
stmt.close( );
rset.close( );
catch( SQLException ex ) {
System.out.println( ex );
Thanks in advance.

Hi Nagarajan,
The code:
try{
               InitialContext ctx = new InitialContext();
               DataSource ds = (DataSource)ctx.lookup("jdbc/MyAlias");
               Connection con = ds.getConnection();
               Statement sm = con.createStatement();
               ResultSet rs = sm.executeQuery("SELECT * FROM TABLE");
               while(rs.next())
                    IPrivateFlightInfoComponentView.IFlightContentElement element = wdContext.nodeFlightContent().createFlightContentElement();
                    String result = rs.getString("COL1");
                    element.setFlightValues(result);
                    wdContext.nodeFlightContent().addElement(element);
                    IPrivateFlightInfoComponentView.IFlightContentElement ele2 = wdContext.nodeFlightContent().createFlightContentElement();
                    String result2 = rs.getString("COL2");
                    ele2.setFrom(result2);
                    wdContext.nodeFlightContent().addElement(ele2);
                    wdContext.nodeFlightContent().moveNext();
               wdContext.nodeFlightContent().moveFirst();
     catch(Exception e){
          wdComponentAPI.getMessageManager().raiseException(e.getMessage(),true);
(changed to True in RaiseException)
I had to make new element aswell, else error.
Hi Maksim Rashchynski,
It has to be possible to display all columns in table in to a UITable, without rewriting query? Or am I wrong?
Regards,
Simon
PS: thanks for all your help.

Similar Messages

  • My screen just locked up and displayed the following pattern. Any ideas why?

    Hello,
    My computer went to sleep and when I awoke it and opened up safari browser, the screen locked up and displayed the attached pattern on my screen.  I could still use the mouse but couldn't click on anything.  I had to reboot.
    Any ideas what could be wrong?

    If it will repeat after restart - hardware problems. Most probably memory.
    Anyway run Apple Hardware Test

  • Using Vector to display ResultSet on multiple pages

    Hi all,
    I want to use Vector for Displaying the ResultSet in multiple pages for my JSP.
    Can anybody assist me on how to display Resultset on multiple pages by using Vectors.
    Thanks for any help in advance.
    regards,
    savdeep

    Haii Pls go through the code
    Vector v=new Vectior()
    while(rs.next())
       v.add(rs.getString(column name));
    v //vector is readyyyyyregards
    Shanu

  • Displaying resultset one record at a time

    This is a rather long question, but I have never done any projects like this before with Java.
    I have an application in which users can view each record within a range of values one at a time. I have created a recordset that is sorted by one column in the resultset. What is the best way to display each record using forward/back buttons to "flip" through each record? How would I keep track of which record in the set I am actually displaying so I can move to either the next or previous depending on which button the user selects? Another problem I have is whether a particular button should be disabled?
    Thanks in advance,
    Chris

    Try this link
    http://www.theserverside.com/resources/article.jsp?l=DataListHandler
    Select the Read PDF here link and it will download the PDF for you to read.
    It's a pattern for the sort of problem that you describe. It comes complete with source code that you could use.
    If you wish you can contact me via e-mail and I'll email you a working example.
    Dave

  • Display and Edit Patterns in XML Tags

    Using LiveCycle E2 V9.
    The display and or Edit Patterns are not reflected in the XML of a submitted form.
    While these display properly on the Adobe form on-screen, e.g.
    $150,000.00 when the fields are are submitted the XML tag as reflects 150000.000000
    Please advise whether there is something that I am doing incorrectly and or a fix for this?
    Thank you!

    Formatted displays for numbers is never the same as the actual field value. This approach allows a user to see a formatted numeric value but the data remains as a number in floating point, integer, or binary value for further calculations as a number. If this were to change, then one would need to parse the numeric value as a character string back to a numeric value before performing any calculation.
    There are specific forums for LiveCycle Designer.

  • Display yellow-lined pattern

    A few days ago a yellow vertical lined pattern appeared & covers my entire display. I can highlight areas of it & lighten them, but can't get them to disappear. I tried different color settings, display settings, and resetting the PRAM but nothing has worked.
    Has anyone had this problem or know how to fix it?
    Thanks!

    I have a similar problem, although the yellow doesn't cover the entire screen. There is a vertical band about 4 inches wide that consistently shows up on "some" windows. Most often it shows up on the tops of windows, but also adds some blue distortion to photos, but not HTML or word docs. The yellow band overlays a blue band that is wider and often "ghosts" the edges of safari/finder windows.
    When i took a screen shot of the problem, it did not show up.
    Resetting the PRAM doesn't help.
    Is there any other trouble shooting I should do before I schedule a "genius" bar appt.
    thanks in advance
    patrick flynn
    brooklyn ny

  • Displaying ResultSet in DataTable component

    Say my program codes have created a ResultSet object by applying some SQL query into the database tables.
    Now I just want to display the contents of that ResultSet object in the JSC DataTable component. Is it possible? If so, how?
    Thank you.

    Hi,
    I think i have found a way to do what we want to do :
    As written in Winston Prakash's Weblog (http://blogs.sun.com/roller/page/winston),
    1) I have created a java class "ResultRowDataProvider" that extends ListObjectDataProvider and that contains a method that fill a list from the resultset. (Later, this list will be automatically used to fill the Table Component)
    That is to say :
    public class ResultRowDataProvider extends ObjectListDataProvider{
    private List resultList = new ArrayList();
    /** Creates a new instance of ResultRowDataProvider */
    public ResultRowDataProvider() {
    setUserResizable(true);
    public void fillResultList(ResultSet rs){
    try{
    rs.beforeFirst();
    while(rs.next())
    resultList.add(new ResultRow(rs.getString(1), rs.getString(2)));
    } catch(SQLException sqle){}
    setList(resultList);
    public int getNbRows(){
    return this.resultList.size();
    2) I have created a java class "ResultRow" where I defined private attributes that the ResultRowDataProvider will provide.
    That is to say :
    public class ResultRow(){
    private String field1;
    private String field2;
    public ResultRow(String field1, String field2){
    this.field1 = field1;
    this.field2 = field2;
    public String getField1(){
    return this.field1;
    public String getField2(){
    return this.field2;
    public void setField1(String field1){
    this.field1 = field1;
    public void setField2(String field2){
    this.field2 = field2;
    3) I finally added the following line to the init( ) method in SessionBean1.java :
    resultRowDataProvider = new ResultRowDataProvider();
    Then it is compulsory to clean and build the project, to close the project and to reopen it so that the table component layout will take into account the ResultRowDataProvider.
    I chose it, but it didn't display the two fields I defined (field1 and field2)
    whereas Winston said it should display them. So I defined the table columns myself using as value : #{currentRow.getValue('field1')} for the field1 column.
    It worked at runtime.
    Now jetsons, I would like to tell you that I personnaly wanted to fill programmatically the Table Component because I am using an Oracle 9.2.0.1 database. In the first version of my project, i used the CachedRowSet. Then I read that i had to use OracleCachedRowSet using ocrs12.jar. But after many bugs at runtime, I had a look to forums and I read that :
    "JDBC drivers provided by Oracle are not suitable for Sun Java Studio Creator, and are not supported. Oracle drivers currently available do not fully implement the JDBC 3.0 Specification. Sun Java Studio Creator requires certain schema information at design time that Oracle drivers do not provide."
    In fact we can use DataDirect but ...
    Filling programmatically a Table Component is a database-independant way ;)
    Thank you for your help jetsons and MISS_DUKE.

  • How do display ResultSet in multiple pages ? Please help !!!

    Hi all,
    I want to display the ResultSet of my JSP in multiple pages.I want to group them as a set of 10 records on one page and so on the output
    displayed on further pages in a set of 10 records per page.
    Is there any Simple way to do that ?
    Any response will be highly appreciated.
    Thanks in advance for any help.
    regards,
    savdeep

    Haii
    From the result set put your values inside any util objects like vector or hastable and make use of them to show the result in the page..
    And again it depends on the requirement..
    regards
    Shanu

  • How to display ResultSet in JTextArea?

    Hey,
    I'm trying to write a method which displays the data from a ResultSet.
    Currently I'm only able to display the last line of information, what is thye best way to go about displaying all info? The method I'm using is below. Thanks in advance for your time!
    public void Retrieve() {
    try {
    String url;
    Connection connect;
    Statement statement;
    url = "jdbc:odbc:CoffeeDSN";
    connect = DriverManager.getConnection(url);
    statement = connect.createStatement();
    ResultSet rs = statement.executeQuery("SELECT * FROM COFFEES");
    if( rs.next() ) {
    jTextArea1.setText(rs.getString(1));
    jTextArea1.setText(rs.getString(3));
    catch (SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    }

    jTextArea1.setText(rs.getString(1));
    jTextArea1.setText(rs.getString(3));Calling 'jTextArea1.setText(...)' overwrites any text that was previously written, hence you only see the last line of information.
    You should change 'setText(...)' to 'append(...)' - don't forget to add newline characters ("\n") as necessary.

  • Ideas to create a method to display a number pattern

    Hey, I need to write a program to display a pattern like...
    1
    2 1
    3 2 1
    for any input value of n.
    I have to create two methods, one will be the main and the other the DisplayPattern...........

    Redle-YeYe wrote:
    Hey, I need to write a program ....much luck with your endeavor!

  • Stuck with grey display and strange pattern!

    My iMac froze a few days ago, so I used the power button to turn it off. Then I restarted  the computer but I had a greyish monitor with the apple logo, and they were filled with little suigly lines. (see photos)
    Then the screen gets a strange pattern on the left side
    and after a while I get the text box telling me to restart.
    But each time I retart I get the same thing, so impossible to open the computer
    to get access to Terminal or Activity Monitor to try and change things.
    Any suggestions?

    See
    What is a kernel panic,
    Technical Note TN2063: Understanding and Debugging Kernel Panics,
    Mac OS X Kernel Panic FAQ,
    Resolving Kernel Panics, and
    Tutorial: Avoiding and eliminating Kernel panics for more details.

  • Macbook Pro displays a diagonally patterned screen

    My MacBook Pro will begin to boot when the screen suddenly becomes distorted by an alternately patterned gray screen. I have performed 2 safeboots and after them, it seems to work fine for just a few (3,4) boots after that. One time when it booted successfully, the screen's background light began to flash very quickly until the screen was distorted again like in the beginning.
    I've tried cleaning the PRAM and the NVRAM also but it did not fix the problem.
    Can somebody help with this? Does anyone know what's causing the problem? Does anyone know how to fix it?
    By-the-way, it won't even turn on right now. :-|

    Looks like graphics chipset problem. Please take it the Apple store and see what can they do for you.
    Best.

  • Positive Value only Display or Edit Pattern

    Hello, could someone please explain how I can prevent a negative result in a calculation field? i.e., a result less than zero. In other words, how can I ensure that users only enter positive values in a numeric field, and that the subsequent simple "subtract" calculation will also remain positive?
    Harry

    THANKS NASSIA, this works for disallowing negatives by force, however it gives me script failed alert.
    Would you know how to suppress "Script Failed" alerts, such as this:
    Script failed (language is formcalc; context is
    xfa[0].form[0].form1[0].SF_CalculationTable[0].acview[1])
    script=(ac[1] / tr[1]) * 100
    Error: arithmetic over/underflow.
    . (+ 25 more...)
    These seem to be only happening because the field is not yet populated, (except with zeros). How do I suppress this error, because the form works fine.

  • Another nooblike question on DataTable and displaying ResultSets from db...

    Hey guys,
    I am trying to follow this tutorial example:
    http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html
    I am doing the second part of the example because the first part is not matching with what I want to do. So if you go through the code and I am sure for you gents its absolutely no problem to analyze and decipher the code. Basically I have a 2 column small table that I want to show up on the screen. I am using this as a learning example. I understand most of the code posted except for the variable 'column1' or 'column2' are. For the life of me I cannot figure out what it is. If someone can fill in the missing gap I would appreciate it. Also another part of the code that is kind of not making sense is the dataTable1.setVar("catalog"); line. Where does the author get 'catalog' from?
    Hope someone can help me out.
    Thanks in advance.
    Surya

    In this line dataTable1.setVar("catalog"); you are making a reference to your value. Inside the datatable, you will refer to the value (a register in the model) as catalog. So you can access all properties of a single register.
    Column1 and column2 are columns in the table.
    It's better to you to see first a more simple example of a datatable.
    http://www.laliluna.de/first-java-server-faces-tutorial.html

  • Pattern Display Question

    I'm guessing this has to do with how it is displayed under the patterns.  I'm looking for a way when the user enters for example $5,000,000.00 it displays the shorthand version of $5M instead.  Is this possible?? Any help on this is much appreciated. Thanks.

    Hi,
    I don't think that there is an automatic/easy way to do this. You probably could do it using script in the exit event. It would have to examine the value, convert it to a string and for each group of three "0", assign a letter.
    EG if it finds three zeros, strip them out of the string and add a "K". If there are six zeros, strip them out and add an M.
    The trouble is you are taking a Number (which you can do further calculations with) and making it a String (which you can't really work with afterwards).
    Also I think that the script will be a bit cumbersome, in dealing with all of the possible inputs. For example, $5,125,030.15.
    Niall

Maybe you are looking for