[JAVA] When two different lists are displayed sequentially



For example, one list brings information on Instagram and the other YouTube

There are times when you have to express it like Instagram1/YouTube1/Instagram2/YouTube2

Of course, the two lists cannot be retrieved from one place. 


List<Map<String,Object>> listA = null;

List<Map<String,Object>> listB = null;


listA = jdbcTemplate.query(sqlA, new Db());

listB = jdbcTemplate.query(sqlB, new Db());


<%

int cntAll = 1;

int indexYoutube = 0;

int indexFaceBook = 0;

for( int indexsAll = 0; indexsAll < 4; indexsAll++ ) { // all - insta and youtube


if( listA.size() > 0 && cntAll<=listA.size() ) {

for( int indexs = indexYoutube; indexs < cntAll; indexs++ ) { 

%>

<li>

<div class="youtubebox">

// youtube show

</div>

</li>

<%

indexYoutube++;

}

}

if( listB.size() > 0 && cntAll<=listB.size() ) {

for(int indexs2=indexFaceBook; indexs2<cntAll; indexs2++){ // 0 , 0 < 1

%>

<li>

<div class="facebox">

// insta show

</div>

</li>

<% indexFaceBook++;

} //for

} // if

cntAll++;

}

%>


😀

Thank you!!

고마워!!

Comments