Link to home
Start Free TrialLog in
Avatar of bbvic
bbvic

asked on

diplay data and page number

I am trying to get data from db and would like to display the bottom.
each row contains 4 products ( 4 cols) and if the row count is 4, then add one from the previous id...
if the row id is equal to 3 then...make another page number which is added one from the provious.
would you please help....

<page id="1">
      <row id="1" cols="4">
            <product product_id="1" />
            <product product_id="2" />
                        <product product_id="3" />
                        <product product_id="5" />
      </row>
      <row id="2" cols="4">
            <product product_id="7" />
            <product product_id="8" />
            <product product_id="9" />
            <product product_id="10" />
      </row>
      <row id="3" cols="4">
            <product product_id="11" />
            <product product_id="12" />
            <product product_id="13" />
            <product product_id="15" />
      </row>
</page>
<page id="2">
            <row id="4" cols="4">
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
      </row>
      <row id="5" cols="4">
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
      </row>
      <row id="6" cols="4">
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
            <product product_id="" />
      </row>

</page>
....
....
...
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> if the row id is equal to 3 then...make another page number

You can create new pages based on multiples of 3:

if ( currentRowNnum % 3 == 0 )
{
  pageNumber ++ ;
  showNewPage () ;

}
Avatar of bbvic
bbvic

ASKER

using java, diplays like the above xml format...

caan you provide more detail code?
Avatar of bbvic

ASKER

using  java code, the below structure diplays like the above format

<page id="value1">
      <row id="value2" cols="value3">
            <product product_id="value4" />
            <product product_id="value5" />
                        <product product_id="value6" />
                        <product product_id="value7" />
      </row>
</page>

How can i create java code?
:-)