The cards are displayed inside a single loop and every iteration of the loop contains a <div class="row">.
A solution could be two loops where the outer loop loops i in 0 .. number_of_cards / number_of_cards_per_line times and the inner loop places number_of_cards_per_line cards into a single line.
Another principle problem with your code is the usage of scriptlets that are deprecated. Instead you can use JSTL tags in the given case <c:foreach>. Following code is written from memory and untested:
It would have been easier to spot the problem quickly had you just compared the JSP-generated HTML to your hand-written HTML. The browser tools are essential for debugging, be sure to utilize them.
And yeah, Java scriptlets in JSP have been deprecated 22 years. 22 years! There is no excuse for using them in JSP pages at this point (or any point in the past two decades). We often hear: "but I'm just a beginner". If so, learning the correct ways from the start is essential.
The Bear has been awakend. Scriptlet users beware!
Seriously. One of the worst things about the Internet is how ancient and obsolete information propagates itself long after it should have vanished. Stuff like Scriptlets, using Class.forName() with database drivers, etc.
So listen to the Bear.
And please, Obaid, don't put so many blank lines in your code samples. It makes them very difficult to read. Blank lines are supposed to do just the opposite. When used sparingly.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.