?
Solved

logic problems

Posted on 2006-10-26
10
Medium Priority
?
181 Views
Last Modified: 2010-04-01
i know its kind of sound crazy to post a logic isses under here.

But i do hope you guys can give me a hand

i have this data structure


masterlicenseid     renewid          dateofdownload        dateofrenewal        
7                              2                    18/6/2006                 4/7/2006
7                              3                    18/6/2006                 5/7/2006
100                          12                   23/8/2006                30/8/2006
143                          16                   18/9/2006                1/9/2006
143                           17                  18/9/2006                2/9/2006
143                           18                  18/9/2006                2/9/2006


i wish to diplat the above information like this in the web page

--------------------------------------------------------------------------------------
masterlicenseid       renewid          dateofdownload            dateofrenewal
---------------------------------------------------------------------------------------
7                           2                        18/6/2006                  4/7/2006
                             3                                                         5/7/2006
--------------------------------------------------------------------------------------
100                       12                      23/8/2006                   30/8/2006
-------------------------------------------------------------------------------------
143                      16                       18/9/2006                 1/9/2006
                            17                                                       2/9/2006
                           18                                                        3/9/2066


************

I am totally know how to perform a resultset caputre from the query to db. But i am not sure how can i make it separate basing on the masterlicenseid.

I am manage to group by using the masterlicenseid, but how can i pass the object back to JSP to display? a the renewedid is dynamic.

How would you tackle this? Please share with me.
0
Comment
Question by:chainreaction
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 

Author Comment

by:chainreaction
ID: 17810197
this is my program

businessLogic.java

..
..
            stmt = dbConnect();
                  String query = "select * from renewedclientlicenses ";
                  rs = stmt.executeQuery(query);
                  while(rs.next()){
                        ob = new object();
                        ob.setDateOfDownload(rs.getString("dateofdownload"));
                        ob.setDateOfRenewal(rs.getString("dateofrenewal"));
                        ob.setMasterlicenseid(rs.getString("masterlicenseid"));
                        ob.setMobileNumber(rs.getString("mobileNumber"));
                        ob.setRenewedlicenseid(rs.getString("renewlicenseid"));
                        ob.setMonth(df.format(rs.getDate("dateofrenewal")));
                        result_list.add(ob);
                  }
..
..

jsp page
..
..
<%
dbConnection db = new dbConnection();
List data_list = db.getData();
object ob = null;
for (int i=0; i<data_list.size(); i++) {
ob = (object)data_list.get(i);
%>
<tr>
      <td><%= ob.getMasterlicenseid() %></td>
      <td><%= ob.getRenewedlicenseid() %></td>
      <td><%= ob.getMobileNumber() %></td>
      
      <td>
            <% if (ob.getMonth().equals("07")) { %>
                  <b>
                  <%= ob.getDateOfRenewal() %>
            </b>
            <% }  else { %>
                        <%= ob.getDateOfRenewal() %>
      <% } %>

..
..

the output is :

masterlicenId renewlicenseid      dateofrenewal            dateof download
7            31            2006-07-04 20:51:28.0      2006-06-18 20:51:42.0
7            32            2006-07-04 20:53:25.0      2006-06-18 20:51:42.0
64            303            2006-08-04 16:19:48.0      2006-06-21 15:25:14.0
64            25            2006-06-29 21:26:10.0      2006-06-21 15:25:14.0
95            215            2006-07-28 09:48:44.0      2006-06-22 09:19:50.0
95            38            2006-07-05 22:51:39.0      2006-06-22 09:19:50.0
143            1            2006-06-23 11:48:37.0      2006-06-22 11:44:15.0
152            152            2006-07-23 11:37:46.0      2006-06-22 12:06:43.0
152            153            2006-07-23 11:40:31.0      2006-06-22 12:06:43.0
      
0
 

Author Comment

by:chainreaction
ID: 17810200
but then i am expecting the output like this...

masterlicenId renewlicenseid      dateofrenewal            dateof download
7            31            2006-07-04 20:51:28.0      2006-06-18 20:51:42.0
            32            2006-07-04 20:53:25.0      2006-06-18 20:51:42.0
64            303            2006-08-04 16:19:48.0      2006-06-21 15:25:14.0
            25            2006-06-29 21:26:10.0      2006-06-21 15:25:14.0
95            215            2006-07-28 09:48:44.0      2006-06-22 09:19:50.0
            38            2006-07-05 22:51:39.0      2006-06-22 09:19:50.0
143            1            2006-06-23 11:48:37.0      2006-06-22 11:44:15.0
152            152            2006-07-23 11:37:46.0      2006-06-22 12:06:43.0
             153            2006-07-23 11:40:31.0      2006-06-22 12:06:43.0
0
 

Author Comment

by:chainreaction
ID: 17810204
can you share your ideas?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Accepted Solution

by:
suprapto45 earned 1440 total points
ID: 17810208
The simple logic would be like

Return query to JSP. The query must be order by masterlicenseid, renewid asc
1. set one temp variable to contain the value of masterlicenseid
1. Loop the result set
    2. if (QUERY(masterlicenseid) == temp)
        3. Do not print masterlicenseid and do not print date of download
    4. else
        5. Print everything
    6. Set the temp to the QUERY(masterlicenseid)
7. End loop

Try to post your current codes and we can have a look
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17810215
Okay,

I saw your codes. Please try my logic and let me know if it does not work
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17810252
Oppp...typo.

>>"set one temp variable to contain the value of masterlicenseid"
You can just set it as an empty String or 0 if it is int
0
 

Author Comment

by:chainreaction
ID: 17810357
supraptor45, i thought the above problem can be easily sovle by HTML Table code?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17810466
>>"can be easily sovle by HTML Table code"
What do you mean?

I do not really get you on this.
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17822908
use Display Tag  
see this for Display Tag
http://displaytag.sourceforge.net/11/

Display tag is very good tag library to display data in tables in your jsps'
0
 
LVL 8

Expert Comment

by:reach2piyush
ID: 17879827
String query = "select * from renewedclientlicenses order by masterlicenseid";

jsp page
..
..
<%
......
String lastRecord = "";
%>
<tr>
     <% if (lastRecord.equals(ob.getMasterlicenseid())) {%>
     <td><%= ob.getMasterlicenseid() %></td>
      <%
         }
         lastRecord = ob.getMasterlicenseid();
       %>
     .......
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question